Champak Posted December 25, 2015 Share Posted December 25, 2015 How can I use the _Timer_SetTimer and _Timer_KillTimer functions without a window or something similar? Link to comment Share on other sites More sharing options...
mikell Posted December 25, 2015 Share Posted December 25, 2015 You could do like this (example) - but depending of the use there are probably simpler ways to get the same result...#include <Timers.au3> HotKeySet("{ESC}", "Terminate") Tooltip(StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 0, 0) _Example_CallBack() Func _Example_CallBack() Local $hGUI = WinGetHandle(AutoItWinGetTitle()) _Timer_SetTimer($hGUI, 1000, "_UpdateTip") ; create timer While 1 Sleep(10) WEnd EndFunc ;==>_Example_CallBack ; call back function Func _UpdateTip($hWnd, $iMsg, $iIDTimer, $iTime) #forceref $hWnd, $iMsg, $iIDTimer, $iTime Tooltip(StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 0, 0) EndFunc Func Terminate() Exit EndFunc ;==>Terminate Link to comment Share on other sites More sharing options...
Champak Posted December 28, 2015 Author Share Posted December 28, 2015 (edited) Thanks.Just a suggestion, maybe it's my error in interpretation, but I think it would be a good idea to add the "WinGetHandle(AutoItWinGetTitle())" as a part of the remarks, because the way the help is worded lead me to believe that without a gui window existing in the script calling the timer function it would not work. "Handle to the window to be associated with the timer. This window must be owned by the calling thread". Or something a little clearer. Edited December 28, 2015 by Champak Link to comment Share on other sites More sharing options...
jguinch Posted December 28, 2015 Share Posted December 28, 2015 It seems that the hwnd can be 0 :_Timer_SetTimer(0, 1000, "_UpdateTip")MSDN says : A handle to the window to be associated with the timer. This window must be owned by the calling thread. If a NULL value for hWnd is passed in along with an nIDEvent of an existing timer, that timer will be replaced in the same way that an existing non-NULL hWnd timer will be.https://msdn.microsoft.com/fr-fr/library/windows/desktop/ms644906(v=vs.85).aspx Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now