dmitryunruh 0 Posted May 17, 2010 #include <Timers.au3> #include <GUIConstantsEx.au3> $hWnd = GUICreate ("Hello World!", 200, 100) GUISetState (@SW_SHOW) $timer = _Timer_SetTimer ($hWnd, 2000, "myInCorrectCallback") If $timer = 0 Then MsgBox (0, "", "Timer was not created") While 1 $msg = GUIGetMsg () Switch ($msg) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func myInCorrectCallback () _Timer_KillTimer ($hWnd, $timer) MsgBox (0, "", "Time out") EndFunc Func myCorrectCallback ($hWnd, $Msg, $iIDTimer, $dwTime) #forceref $hWnd, $Msg, $iIDTimer, $dwTime _Timer_KillTimer ($hWnd, $timer) MsgBox (0, "", "Time out") EndFunc ---------------------------------------------------------------------- This code leads to AutoIt hangup. Share this post Link to post Share on other sites
jfcby 3 Posted May 18, 2010 Welcome to the AutoitForums dmitryunruh,From the examples in the help file you only need to have one function to _Timer_KillTimer and then call it when ever needed.$hWnd = GUICreate ("Hello World!", 200, 100) GUISetState (@SW_SHOW) $timer = _Timer_SetTimer ($hWnd, 2000, "myCorrectCallback") If $timer = 0 Then MsgBox (0, "", "Timer was not created") While 1 $msg = GUIGetMsg () Switch ($msg) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func myInCorrectCallback () MsgBox (0, "Debug myInCorrectCallback:", "Time out Incorrect Call Back") EndFunc ;==>myInCorrectCallback Func myCorrectCallback ($hWnd, $Msg, $iIDTimer, $dwTime) #forceref $hWnd, $Msg, $iIDTimer, $dwTime _Timer_KillTimer ($hWnd, $timer) MsgBox (0, "Debug myCorrectCallback:", "Time out Correct Callback") myInCorrectCallback() EndFunc ;==>myCorrectCallbackjfcby Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB **** Share this post Link to post Share on other sites