wi1d Posted July 11, 2006 Posted July 11, 2006 Does anyone have any suggestions as to what is wrong with this code? I tried several different ways to exit the second loop when I push stop on the GUI. All have failed. Func _alertClient() $frmAlertClient = GUICreate("Alert Client", 187, 54, 347, 280) $btnStart = GUICtrlCreateButton("&Start", 8, 16, 75, 25, $BS_DEFPUSHBUTTON) $btnStop = GUICtrlCreateButton("S&top", 104, 16, 75, 25) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUISetState(@SW_Hide, $frmAlertClient) ExitLoop Case $msg = $btnStart While 1 ;=========endless loop starts here $msg = GuiGetMsg() If $msg = $btnStop Then ExitLoop _Talk("Attention") sleep(1000) _Talk("Could the owner of this computer please return.") sleep(3000) WEnd MsgBox(64, "Alert Stopped", "Client alert has been stopped.") Case Else ;;;;;;; EndSelect WEnd EndFunc
Knight Posted July 11, 2006 Posted July 11, 2006 GUIGetMsg is only checking every 4 seconds because of the sleeps. Remove the sleeps and try an alternate method using TimerInit() or something.
wi1d Posted July 11, 2006 Author Posted July 11, 2006 (edited) Thanks a lot. Worked like a charm. Edited July 11, 2006 by wi1d
/dev/null Posted July 11, 2006 Posted July 11, 2006 Thanks a lot. Worked like a charm.Just a suggestion:There is one problem with your two loops. After you've pressed the start button, you cannot close the application until you press the stop button, as the GUI_EVENT_CLOSE message does not get processed in your inner loop. Maybe that's intentional, maybe not. You could set a variable after the start button was pressed. and then check that variable in your "outer" while loop, when the stop button gets pressed.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
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