A version of this page is also available for
This function destroys the specified timer. The system searches the message queue for any pending WM_TIMER messages associated with the timer and removes them.
BOOL KillTimer( HWND hWnd, UINT uIDEvent );
[in] Handle to the window associated with the specified timer. This value must be the same as the hWnd value passed to the SetTimer function that created the timer.
[in] Specifies the identifier of the timer to be destroyed. If the window handle passed to SetTimer is valid, this parameter must be the same as the uIDEvent value passed to SetTimer. If the application calls SetTimer with hWnd set to NULL, this parameter must be the timer identifier returned by SetTimer.
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
After the timer terminates, you will not get WM_TIMER messages regardless of whether the timer has fired.
The timers are kept in a list on the message queue. If there are no other higher priority posted messages, the list is searched for timers that have fired. If a timer has fired a WM_TIMER message is returned in GetMessage. When KillTimer is called, the timer is removed from the list immediately. The next time GetMessage is called it will be impossible to get a WM_TIMER message from the timer because it is no longer in the message queue's list of timers.
If the uElapse parameter of the SetTimer function is set to INFINITE, KillTimer fails to destroy the timer.
|Windows Embedded CE||Windows CE 1.0 and later|
|Windows Mobile||Windows Mobile Version 5.0 and later|