Skip to main content
GameDev.net gamedev.net
🔒 Locked

Automatic timer messages

Started by atreyu Oct 25, 2000 at 7:11 PM 1 replies 200+ views
Original Post
atreyu
atreyu
Hi, I have to find a way to make my (Win32/MFC/C++) program call a function at a given time every day. How would I do this without having to constantly check the time. Is there a way windows can send a message when it''s 2:00PM or something like that? Any help would go a long way. Thanks, Atreyu
Gaiiden
Gaiiden
Well, there are such things as system timers that you create with the SetTimer() function and they produce a WM_TIMER message every n seconds. You could get the current system time when the program starts (dunno how to do that) and then do a bit of math to see how many seconds it''ll take before 2 o clock and then in the WM_TIMER message handler just put in a code bloack to test for that amount of seconds. Kinda really dirty but it could work. Hope this helps.

==============================
"Need more eeenput..."

- #5, "Short Circuit"
==============================
Drew Sikora
Executive Producer
GameDev.net
Friday13
Friday13
Use SetTimer to set timer and GetLocalTime inside yor TimerProc callback to get current time.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.