3 out of 5 rated this helpful - Rate this topic

KillTimer function

Applies to: desktop apps only

Destroys the specified timer.

Syntax

BOOL WINAPI KillTimer(
  __in_opt  HWND hWnd,
  __in      UINT_PTR uIDEvent
);

Parameters

hWnd [in, optional]

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.

uIDEvent [in]

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:

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

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
SetTimer
WM_TIMER
Conceptual
Timers

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
C# syntax
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool KillTimer(IntPtr hwnd, int idEvent);
vb.net syntax
<DllImport("user32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)> _
Public Shared Function KillTimer(ByVal hwnd As IntPtr, ByVal idEvent As Integer) As Boolean
End Function