![]() One way to accomplish this is to create a special routine that traps mouse input until a specific event occurs. Sometimes it is necessary to prevent more input while you have a mouse pointer on the screen. Using Timer Functions to Trap Mouse Input The following example destroys the timers identified by the constants IDT_TIMER1, IDT_TIMER2, and IDT_TIMER3. TranslateMessage(&msg) // translates virtual-key codesĭispatchMessage(&msg) // dispatches message to windowĪpplications should use the KillTimer function to destroy timers that are no longer necessary. ![]() Post WM_TIMER messages to the hwndTimer procedure. NULL, // handle to window to receive the message While (GetMessage(&msg, // message structure HWND hwndTimer // handle to window for timer messages If your application creates a timer without specifying a window handle, your application must monitor the message queue for WM_TIMER messages and dispatch them to the appropriate window. The calling convention for MyTimerProc must be based on the TimerProc callback function. (TIMERPROC) MyTimerProc) // timer callback case WM_TIMER:Īn application can also create a timer whose WM_TIMER messages are processed not by the main window procedure but by an application-defined callback function, as in the following code sample, which creates a timer and uses the callback function MyTimerProc to process the timer's WM_TIMER messages. To process the WM_TIMER messages generated by these timers, add a WM_TIMER case statement to the window procedure for the hwnd parameter. The first timer is set for every 10 seconds, the second for every five minutes. ![]() The following example uses the SetTimer function to create two timers.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |