Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running programs at intervals less than one minute?

Status
Not open for further replies.

kylefield

Technical User
Nov 10, 2005
7
US
I have a program I wrote that I want to execute regularly. Right now, I have compiled it as an .exe and it runs every minute using Windows Scheduler. This works fine.

Is there any way to do it in intervals less than a minute, say every 30 seconds?

Thanks.
 
You could run the program continuously in a loop and use a call to the Sleep API to suspend execution for 30 seconds on each run through:
Code:
lnSnooze = 30000
DECLARE Integer Sleep IN Win32API Integer
=Sleep(lnSnooze)                      && Pause for 30 seconds

Geoff Franklin
 
Why not have your program run idle continously and use a timer to launch a specific task at the interval you choose?

That's certainly the simplest way of doing it. The only problem is that Fox will be running all the time and slowing down everything else on the machine. The call to the Sleep API asks Windows to suspend Fox and to wake it up every thirty seconds.

On the other hand, does it really matter on a modern PC if you have a full-blown database program running all day every day just reading the system clock thousands of times a second? I may be showing my age by even asking this question<g>.

Geoff Franklin
 
Hi Geoff,

If the VFP program is idle, it CPU usage will be quite low. Memory footprint will depend on the size of the executable but even an 8mg program would be managable.



Jean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top