Search the Community
Showing results for tags '$GUI_EVENT_CLOSE'.
-
Hi Guys, This is probably a simple question but im bumping my head against a wall currently. I have a script/app that I do not want a use to close by mistake when a certain Task is in progress. As such I created an Exit function and posed a question within the function that asks a user if they are sure they want to exit as the Task is still running. The problem I have is regardless on wether the user clicks on YES or NO the script still exits when it his the end of the function. Here is a sample of my code. $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") OnAutoItExitRegister("ExitDaApp") $CaptureStatus = True #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> Global $GuiMain = GUICreate("Test", 943, 523, 176, 129) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $CaptureStatus = True Then ReadLogs() EndIf Sleep(10) WEnd ;----------------------------------------------------------------------------- ;ExitDaApp - FUNCTION TO ;----------------------------------------------------------------------------- Func ExitDaApp() SplashOff() If $CaptureStatus = True Then If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(262420,"EXIT","Capture currently running, Are you sure you want to exit?") If $iMsgBoxAnswer = "6" Then Exit Else Return EndIf Else Exit EndIf EndFunc ;===> ExitDaApp ;----------------------------------------------------------------------------- ;ReadLogs - FUNCTION TO ;----------------------------------------------------------------------------- Func ReadLogs() ;just read through soem log files. EndFunc ;===> ReadLogs