d0n Posted June 23, 2009 Share Posted June 23, 2009 How come the on event close does not seem to work? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Server Status", 80, 40) $Label1 = GUICtrlCreateLabel("", 10, 10, 70, 20) GUISetState(@SW_SHOW) Gui() Func Check() $var = Ping("75.150.216.162",250) If $var Then GUICtrlSetData($Label1, "Server Online") Else GUICtrlSetData($Label1, "Server Offline") EndIf EndFunc Func Gui() While 1 $Msg = GUIGetMsg() If $Msg = $GUI_EVENT_CLOSE Then Exit EndIf Check() Sleep(500) WEnd EndFunc Link to comment Share on other sites More sharing options...
enaiman Posted June 23, 2009 Share Posted June 23, 2009 Sleep inside main loop in this mode = big NO-NO. Use OnEvent Mode if you need sleep time or, put the sleep inside your Check() function. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
d0n Posted June 23, 2009 Author Share Posted June 23, 2009 That still doesn't close my GUI, unless i missed something :S Link to comment Share on other sites More sharing options...
Valuater Posted June 23, 2009 Share Posted June 23, 2009 The sleep(500) was "most" of the prob AFAIK #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $Ping_Complete = False $Form1 = GUICreate("Server Status", 80, 40) $Label1 = GUICtrlCreateLabel("", 10, 10, 70, 20) GUISetState(@SW_SHOW) Gui() Func Check() $var = Ping("75.150.216.162", 250) If $var Then GUICtrlSetData($Label1, "Server Online") Else GUICtrlSetData($Label1, "Server Offline") EndIf $Ping_Complete = True EndFunc ;==>Check Func Gui() While 1 $Msg = GUIGetMsg() If $Msg = $GUI_EVENT_CLOSE Then Exit EndIf If Not $Ping_Complete Then Check() WEnd EndFunc ;==>Gui 8) Link to comment Share on other sites More sharing options...
d0n Posted June 23, 2009 Author Share Posted June 23, 2009 thanks for the help 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