473,408 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Vb App - Schedule?

iam_clint
1,208 Expert 1GB
I am having a problem with an App i've tried a couple different routes..


I need to call a function in one of my vb apps at set times. Even while logged out of the "server" its going to be running on... So I have my app running as a service but even with my api timer the function never fires. Any help on this would be appreciated.

-- the function fires at the set time if i'm logged into the computer with the app open at set time --
Jan 28 '08 #1
13 1581
daniel aristidou
491 256MB
I need to call a function in one of my vb apps at set times. Even while logged out of the "server" its going to be running on... So I have my app running as a service but even with my api timer the function never fires. Any help on this would be appreciated.
-- the function fires at the set time if i'm logged into the computer with the app open at set time --
Hi could you post the code used to fire the function.
Daniel(~_~)
Jan 28 '08 #2
iam_clint
1,208 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. Public WithEvents mobjTmr As vbAPITimerTools.APITimer
  2. 'on initiate it does this
  3. Set mobjTmr = New vbAPITimerTools.APITimer
  4. mobjTmr.StartTimer 100
  5.  
Expand|Select|Wrap|Line Numbers
  1. Private Sub mobjTmr_Refresh()
  2.     Dim curTime As Date
  3.     curTime = Time
  4.     strDate = Format(curTime, "HH:MM:SS AM/PM")
  5.     ccTime.Caption = strDate
  6.     If (strDate = "2:01:00 AM") Then
  7.         Call Form_Load
  8.         Call Command1_Click
  9.     End If
  10. End Sub
  11.  
Jan 28 '08 #3
daniel aristidou
491 256MB
Expand|Select|Wrap|Line Numbers
  1. Public WithEvents mobjTmr As vbAPITimerTools.APITimer
  2. 'on initiate it does this
  3. Set mobjTmr = New vbAPITimerTools.APITimer
  4. mobjTmr.StartTimer 100
  5.  
Expand|Select|Wrap|Line Numbers
  1. Private Sub mobjTmr_Refresh()
  2. Dim curTime As Date
  3. curTime = Time
  4. strDate = Format(curTime, "HH:MM:SS AM/PM")
  5. ccTime.Caption = strDate
  6. If (strDate = "2:01:00 AM") Then
  7. Call Form_Load
  8. Call Command1_Click
  9. End If
  10. End Sub
  11.  
Hi ..
Try changing this line...
Expand|Select|Wrap|Line Numbers
  1.  strDate = Format(curTime, "HH:MM:SS AM/PM") 
  2. ccTime.Caption = strDate
  3. If (strDate = "2:01:00 AM") Then
  4. Call Form_Load
  5. 'To 
  6. strDate = Format(curTime, "HH:MM AM/PM")
  7. ccTime.Caption = strDate
  8. If (strDate = "2:01 AM") Then
  9. Call Form_Load
  10.  
Question just to be sure the 100 in this line is the interval?
mobjTmr.StartTimer 100
Jan 28 '08 #4
Killer42
8,435 Expert 8TB
Expand|Select|Wrap|Line Numbers
  1.  strDate = Format(curTime, "HH:MM:SS AM/PM") 
  2. ...
  3. strDate = Format(curTime, "HH:MM AM/PM")
Why would changing the time format make any difference? In fact, wouldn't this potentially cause the process to happen multiple times when it's only wanted once? Or does the "100" mean ten seconds, or something?
Jan 29 '08 #5
iam_clint
1,208 Expert 1GB
100 is 100 milliseconds and changing the time format shouldn't change anything since when I am logged in the app fires on time every time...
100 milliseconds should hit within that 1 second period about 9 times at least. but since the app would be busy it wouldn't hit it more than once. the app takes well over 30 minutes to finish what its doing.

when i'm not logged into the system (not logged in... not shut down just not logged in) it doesn't fire.
Jan 29 '08 #6
daniel aristidou
491 256MB
100 is 100 milliseconds and changing the time format shouldn't change anything since when I am logged in the app fires on time every time...
100 milliseconds should hit within that 1 second period about 9 times at least. but since the app would be busy it wouldn't hit it more than once. the app takes well over 30 minutes to finish what its doing.

when i'm not logged into the system (not logged in... not shut down just not logged in) it doesn't fire.
To make things Clear........
The if Statement never returns True?
Or
When The If statement = True ;you get no results?
Also
Does the loggin have any relation to the timer you are using? To check this you might want to try disableing the login function....
I think the problem might be to do with the login...
Can explain the login logic you are using.
Jan 29 '08 #7
iam_clint
1,208 Expert 1GB
To make things Clear........
The if Statement never returns True?
Or
When The If statement = True ;you get no results?
Also
Does the loggin have any relation to the timer you are using? To check this you might want to try disableing the login function....
I think the problem might be to do with the login...
Can explain the login logic you are using.
Not a login for the app .. Windows login

No relation to the timer.


the events fire when the app is running and logged into windows

when the app is running and your not logged into windows no events fire.
Jan 29 '08 #8
Killer42
8,435 Expert 8TB
I don't know whether it matters, but what version of Windows?

Also, I'm thinking this question might be better handled in the Windows forum, as it's probably not a language-specific issue. If I'm reading it correctly, you just need to know how to get an application loaded as a service to process timer events when nobody is logged in.
Jan 29 '08 #9
iam_clint
1,208 Expert 1GB
its windows 2003 server
Jan 30 '08 #10
How about using the Task Scheduler?
Jan 30 '08 #11
kadghar
1,295 Expert 1GB
Why would changing the time format make any difference? In fact, wouldn't this potentially cause the process to happen multiple times when it's only wanted once? Or does the "100" mean ten seconds, or something?

I dont think its such a weird idea, i think that while working with dates, its better to use an interval in the IF rather than an exact time.
i.e.

you may be so lucky that if you say
Expand|Select|Wrap|Line Numbers
  1. If MyTime = "2:30 AM" then
  2.   'Do something
  3. End if
Will work if the timer tics in that very moment

But i'd say that something like:
Expand|Select|Wrap|Line Numbers
  1. if mytime >= "2:30 AM" and mytime < "2:31 AM" then
  2.     'Do something
  3. End if
with a larger interval will do

But since you dont know the speed of the users computer, to make sure the event will only happen once, but it'll certainly happen, write (inside the timer) something like

Expand|Select|Wrap|Line Numbers
  1. Dim Boo1 as boolean
  2. If mytime <= "2.30 AM" then boo1=true
  3. if mytime >= "2.30 AM" and Boo1 = true then
  4.     'Do something
  5.     boo1=false
  6. end if
or any other variant of "using a boolean to only do it once" will help.
Jan 30 '08 #12
kadghar
1,295 Expert 1GB
its windows 2003 server
I dont know where does it gets the time from, if its from the logged in client, why dont you try making your "own clock" in the app that refreshes each time somebody is logged in, so when nobody is, instead of checking the system's time, it'll check the one you created.

This might give you some headaches, cause if nobody logs in for a while, it wont be sharp on time. But it's an alternative in case you dont find how to call the time when nobody is logged in.
Jan 30 '08 #13
iam_clint
1,208 Expert 1GB
(this is my server its running on i know its settings.) the app won't fire while i'm "logged off" of windows.. but the app will fire while i'm "logged in" windows.

You think that the system time changes or doesn't update while a user isn't logged in?
Jan 31 '08 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Adisorn Ratanakovit | last post by:
When you set up a full-text catalog in SQL Server and you set up the population schedule, a job gets created and scheduled under SQL Server Agent. The problem I encountered recently is when I...
1
by: bigfella | last post by:
Hi Everyone, I am using the following code (many thanks for the code folks BTW) to generate 3 schedules in three tables one is a schedule with 7 day intervals and two are daily schedules. The...
0
by: argniw | last post by:
I have a schedule of annual events that need to occur in different locations throughout the year. Each event has a due date associated with it. I also have an optimal schedule that consolidates...
1
by: greg7224 | last post by:
I am currently working on a C# project that uses the Janus schedule controls, and am having trouble getting it to print correctly in Day view. The problem is that it will not print out the owners...
3
by: tstutting | last post by:
Hello, This is my first post and I'd really appreciate any help I can get. Sorry this is so long but it's complicated. I'm a USAF Officer and I'm attempting to make a shared MS Access DB that...
7
by: hgirma | last post by:
Hello Gurus, Is it possible to schedule a task to run an application deployed using ClickOnce? The executable changes location with each update.. and if i were to run the executable directly,...
3
by: assgar | last post by:
Hi I am having problem with my loping. I don't know if I have chosen the correct approach. GOAL: I need to insert into a table event types for a specific date range. The calendar the event...
14
lotus18
by: lotus18 | last post by:
Hello all I have these records on my Day Table for my complete database table please click here 1. M 2. T 3. W 4. TH 5. F 6. S
5
by: btraveler747 | last post by:
We have this database to track all our employees. I am trying to build a 14 day schedule to track all employees appointments leaves etc... I am sure this needs to be done in vba code but I am not...
1
Czechnology
by: Czechnology | last post by:
Hi all! I'm programming a small internet radio player in C# and as a part of it, I wanted to include the station's time schedule. Now the problem is, I have no idea what would be the best...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.