Solved

Alarm clock

Posted on 2000-05-12
9
196 Views
Last Modified: 2010-05-02
Is there any way to schedule tasks to launch without constanly running a timer to check the current date & time against the scheduled time?

This will need to run on a server, so I need to use as little processor and memory overhead as possible.
0
Comment
Question by:Shish
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2804991
Yes, use the Task Scheduler.
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2805008
From fonnie:

  Yes, there is.  NT uses the AT scheduler service, (which is not started by default).  A GUI front end called WinAT is in the NT Resource Kit.
  Also, there are several third-party schedulers available.

  If the programs that need to run work ONLY on the local machine and do not need ANY network access, then AT is usable.  For running programs which use the network, I use WebWilly (I didn't name it) but there many others.




 
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2805018
For example,

at 12:00 /every:Mo,Tu,We,Th,Fr,Sa,Su cmd /c batch.bat

0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 2

Expert Comment

by:Crin
ID: 2805019
Hello,

When user set alarm time you can just calculate a number of milliseconds for Timer control and set Interval property to it. As soon as maximum of Interval property is 65,535 you can use API function Sleep that use Long for delay and make a loop with it with incremental counter or recalculator of estimated time before alarm.

Use

Public Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

Sincerely yours,

Crin

0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2805026
Since you said it is running "on a server", I assume the server is running WinNT (workstation or server).
0
 

Author Comment

by:Shish
ID: 2805030
It will get too messy if I try to use the Windows Task Scheduler.  I only need to run a few lines of code per alarm event, but I have dozens of alarm events.

Basically need to do just what the Task Scheduler does, but I want to run it from inside my program and keep it contained within the program.
0
 
LVL 2

Expert Comment

by:Crin
ID: 2805037
hehe :)

GivenRandy, your answer is absolete right, but it must be posted under Windows section, not VB... Same I could say to Shish if GivenRandy's comment is that you expected :))

Sincerely yours,

Crin
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 50 total points
ID: 2805819
A timer on a form does not use much in the way of processor cycles if the interval is set to 1000 or even 10000 (every ten seconds.)  If your scheduling code in the timer event is efficient, it should not impact the CPU in a significant way.  

In terms of memory, any VB program is going to come with the overhead of the VB runtimes, which is not insignificant, but probably won't cripple your server.

Crin's solution would work if you were only polling for one schedule event, but the sleep API will stop your program from checking for other events.
0
 
LVL 2

Expert Comment

by:Crin
ID: 2808789
Comment on PaulHews comment:
not for ONE scheduled event, but for sorted list of scheduled events :)))
And, of course, I forgot to describe that Sleep API freeze your programm...

Sincerely yours,
Crin

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question