Run on Date and time

I have a program that i need to run a function on a specific date and or time. How do you do this?
Thank you in advance.
[132 byte] By [strych9] at [2007-11-18 17:41:27]
# 1 Re: Run on Date and time
Do you need to run that programm at specific time, or do you have it running and want to call a function at that time?
VladimirF at 2007-11-11 1:26:04 >
# 2 Re: Run on Date and time
I want to call a function at that time.
strych9 at 2007-11-11 1:27:04 >
# 3 Re: Run on Date and time
Then when your program starts (in InitInstance()?) set a timer for the time difference between target time and current time, and call your function when you'd get OnTimer event.
One minor problem - since SetTimer() takes time in milliseconds, you might overflow your int. In such case, simply set another timer instead, where you would repeat this action again, until there is no overflow.
VladimirF at 2007-11-11 1:28:05 >
# 4 Re: Run on Date and time
look at the "The Task Scheduler API" you can find info on msdn.microsoft.com
Mick at 2007-11-11 1:29:11 >