Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

KillTimer

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

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 
); 

hWnd

[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.

uIDEvent

[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.

Headerwinbase.h
Windows Embedded CEWindows CE 1.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show:
© 2015 Microsoft