Function Reference


_WinAPI_KillTimer

Destroys the specified timer

#include <WinAPISysWin.au3>
_WinAPI_KillTimer ( $hWnd, $iTimerID )

Parameters

$hWnd Handle to the window associated with the specified timer. This value must be the same as the
$hWnd value passed to the _WinAPI_SetTimer() function that created the timer.
$iTimerID The timer identifier which specifies the timer to be destroyed.

Return Value

Success: True.
Failure: False, call _WinAPI_GetLastError() to get extended error information

Remarks

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

Related

_WinAPI_SetTimer

See Also

Search KillTimer in MSDN Library.

Example

#include <Misc.au3>
#include <WinAPISysWin.au3>

Opt('TrayAutoPause', 0)

Global $g_iCount = 0

_Example()

Func _Example()
        Local $hTimerProc = DllCallbackRegister('_TimerProc', 'none', 'hwnd;uint;uint_ptr;dword')

        Local $iTimerID = _WinAPI_SetTimer(0, 0, 1000, DllCallbackGetPtr($hTimerProc))

        Do
                Sleep(100)
        Until _IsPressed('1B')

        _WinAPI_KillTimer(0, $iTimerID)
        DllCallbackFree($hTimerProc)

EndFunc   ;==>_Example

Func _TimerProc($hWnd, $iMsg, $iTimerID, $iTime)
        #forceref $hWnd, $iMsg, $iTimerID, $iTime

        ConsoleWrite($g_iCount & @CRLF)
        $g_iCount += 1
EndFunc   ;==>_TimerProc