Windows NT and Windows 98 include a very useful tool called the "Task Scheduler".
You can get a copy of this tool by downloading from http://www.microsoft.com/windows/ie/ie40/download
I run four or five programs on a periodic basis from once an hour to once a day (including backups). I used to have the programs running from VFP Timer events (which works fine), but it chews up memory when inactive. The Task Scheduler sits as a Windows NT Service and fires up when you schedule it and leaves a log for after-the-fact checking.
I'm now using this instead of the Foxpro Timer event (or in combination - ie. Fire the Foxpro program up and let it check for particular conditions once an hour for 6 hours and then close down).
The only difficulty I am having is that the Scheduler allows for an Exit Code and I can't seem to find any way of setting this from within VFP.
I've just found the way to set the Exit Code via a comment from Ed Rauh.
DECLARE Exit Process in Win 32 API ;
INTEGER Exit Code
After issuing a CLEAR EVENTS and FLUSH, call Exit Process with an integer value in the range -(2^31) to (2^31)-1
Works like a charm. The NT Task Scheduler picks up the Exit code correctly, but the Log shows:
Result: Unable to find a message for task exit code(3).
In other words, the Exit Code is picked up, but there seems to be an option to Exit with a Text message.
Anyone have any ideas on this ?
Category Windows OS
( Topic last updated: 1999.08.05 01:31:48 PM )