Greetings,
I'm using AdlibRegister("AdlibFunc", 2000) to run a function every 2 seconds.
However, sometimes the func my take longer than the time scecified.
To prevent the functions running overlapped, I use 'AdlibUnRegister("AdlibFunc")' as the first statement in "AdlibFunc".
This appears not to work as I expect.
Below is a model of the problem
Code:
Any hints?
JO
I'm using AdlibRegister("AdlibFunc", 2000) to run a function every 2 seconds.
However, sometimes the func my take longer than the time scecified.
To prevent the functions running overlapped, I use 'AdlibUnRegister("AdlibFunc")' as the first statement in "AdlibFunc".
This appears not to work as I expect.
Below is a model of the problem
Code:
[ autoit ]
#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Proc1Form1", 309, 158, 353, 167) $Label1 = GUICtrlCreateLabel("Label1", 32, 24, 100, 30) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Opt("GUIOnEventMode", 1) ; Change to OnEvent mode GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_checkGUI") AdlibFunc() $CNT = 0 while(true) $CNT += 1 GUICtrlSetData($Label1, "CNT=" &$CNT) Sleep(100) wend Func GUI_checkGUI() Local $tab, $msg If (@GUI_CTRLID = $GUI_EVENT_CLOSE) Then exit EndIf EndFunc Func AdlibFunc() AdlibUnRegister() GUICtrlSetData($Label1, "XXXX") Sleep(3000) AdlibRegister("AdlibFunc", 2000) EndFunc
Any hints?
JO