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
Solved

Alarm clock

Posted on 2000-05-12
9
195 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
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 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