﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
3934	_WinAPI_SetTimer TimerID must be nonzero	KaFu	Jpm	"""A nonzero timer identifier"" should be added to the TimerID description in _WinAPI_SetTimer().

Otherwise if set to 0, the return value of the function is not the TimerID.

See also:
https://www.autoitscript.com/forum/topic/209219-centered-fileopendialog-using-self-terminating-wm_timer-call/?do=findComment&comment=1509811

Maybe add a second example for this scenario without a callback function.



{{{
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <WinAPISysWin.au3>
#include <WindowsConstants.au3>

Opt('TrayAutoPause', 0)

Global $g_iCount = 0
Local $iTimerID = 999

Local $hGUI = GUICreate(""Example"")
GUIRegisterMsg($WM_TIMER, ""WM_TIMER"")

$iTimerID = _WinAPI_SetTimer($hGUI, $iTimerID, 1000, 0)

Do
    Sleep(100)
Until _IsPressed('1B')

_WinAPI_KillTimer($hGUI, $iTimerID)


Func WM_TIMER($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam, $ilParam

    ConsoleWrite($g_iCount & @CRLF)
    $g_iCount += 1

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_TIMER
}}}
"	Feature Request	closed	3.3.17.0	Documentation		None	Completed		
