SetTimer (Windows CE 5.0)
This function creates a timer with the specified time-out value.
UINTSetTimer( HWNDhWnd, UINTnIDEvent, UINTuElapse, TIMERPROClpTimerFunc );
Parameters
hWnd
[in] Handle to the window to be associated with the timer. This window must be owned by the calling thread. If this parameter is NULL, no window is associated with the timer and the nIDEvent parameter is ignored.nIDEvent
[in] Specifies a nonzero timer identifier. If the hWnd parameter is NULL, this parameter is ignored.uElapse
[in] Specifies the time-out value, in milliseconds.lpTimerFunc
[in] Long pointer to the function to be notified when the time-out value elapses. For more information about the function, see TimerProc.If lpTimerFunc is NULL, the system posts a WM_TIMER message to the application queue. The hwnd member of the message's MSG structure contains the value of the hWnd parameter.
Return Values
An integer identifying the new timer indicates success. An application can pass this value, or the string identifier, if it exists, to the KillTimer function to destroy the timer. Zero indicates failure. To get extended error information, call GetLastError.
Remarks
If the uElapse parameter is set to INFINITE, KillTimer fails to destroy the timer.
An application can process WM_TIMER messages by including a WM_TIMER case statement in the window procedure or by specifying a TimerProc callback function when creating the timer. When you specify a TimerProc callback function, the default window procedure calls the callback function when it processes WM_TIMER. Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc instead of processing WM_TIMER.
The wParam parameter of the WM_TIMER message contains the value of the nIDEvent parameter.
If SetTimer is called with hWnd set to NULL and lpTimerFunc set to NULL, WM_TIMER message will not be delivered.
Requirements
OS Versions: Windows CE 2.0 and later.
Header: Winuser.h.
See Also
KillTimer | TimerProc | WM_TIMER | MSG
Send Feedback on this topic to the authors