KillTimer function (winuser.h)

Destroys the specified timer.

Syntax

BOOL KillTimer(
  [in, optional] HWND     hWnd,
  [in]           UINT_PTR uIDEvent
);

Parameters

[in, optional] hWnd

Type: HWND

A 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] uIDEvent

Type: UINT_PTR

The timer to be destroyed. If the window handle passed to SetTimer is valid, this parameter must be the same as the nIDEvent

value passed to SetTimer. If the application calls SetTimer with hWnd set to NULL, this parameter must be the timer identifier returned by SetTimer.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The KillTimer function does not remove WM_TIMER messages already posted to the message queue.

Examples

For an example, see Destroying a Timer.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-window-l1-1-2 (introduced in Windows 10, version 10.0.10240)

See also

Conceptual

Reference

SetTimer

Timers

WM_TIMER