|
-
Oct 12th, 2001, 11:41 PM
#1
Thread Starter
Addicted Member
Timer
Hello, I was wandering how I could make a timer with an intervall of a minute and the message it send every minutes?
-
Oct 12th, 2001, 11:59 PM
#2
PowerPoster
I don't wanna write the whole program but...
Use "SetTimer" API to create a new timer when you have create your window under "WinMain()" or any other place.
Then, you will get a message called "WM_TIMER" after each time that you specified.
So if you want to create a timer that sends the "WM_TIMER" message after each second, then it would look like this:
PHP Code:
SetTimer(winhwnd,1,1000,NULL);
/*winhwnd = handle of the window which will receive the WM_TIMER message*/
//1 = the timer ID
/*1000 = after the time in milliseconds,each time, you want to send a WM_TIMER message*/
/*NULL = if you want to have your own procedure for the timer then you can specify that here, otherwise, it will send your window a WM_TIMER message*/
//.................
//Received a WM_TIMER message
case WM_TIMER
MessageBox(NULL,"After every second","A",MB_OK);
//When we are done with the timer, we kill it using...
KillTimer(winhwnd, 1)
//1 = the timer ID
Hope that helps
-
Oct 13th, 2001, 12:14 AM
#3
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|