Cambo Posted December 19, 2007 Posted December 19, 2007 This is a really simple question and I feel kind of stupid for having to ask it, but is there a way to map the X button? (default windows close button) Right now when I run my compiled script, the big red X does absolutely nothing. I've browsed through the GUI documentation but don't see anything. And actually I need it to do a little more than just close the program. Right now F6 closes my script, and it does a few other things on the closing. On exit right now it does: writeLog("Quit program. Deleted temp files") FileClose($Name) FileClose($file) Is there a way to map the big shiny red X to do that?
The Ape Posted December 19, 2007 Posted December 19, 2007 While 1 $msg = GUIGetMsg() Select Case $msg = $Something ;;;;something happens Case $msg = $GUI_EVENT_CLOSE writeLog("Quit program. Deleted temp files") FileClose($Name) FileClose($file) Exit EndSelect WendoÝ÷ Ù«¢+Ù]¡¥±Ä(ÀÌØíµÍôU%Ñ5Í ¤((%ÀÌØíµÍôÀÌØíU%}Y9Q} 1=MQ¡¸(ÝÉ¥Ñ1½ ÅÕ½ÐíEÕ¥ÐÁɽɴ¸±ÑѵÀ¥±ÌÅÕ½Ðì¤(¥± ±½Í ÀÌØí9µ¤(¥± ±½Í ÀÌØí¥±¤(á¥Ð(¹%)]¹ FixJaw.comTriad-Art.com
PsaltyDS Posted December 19, 2007 Posted December 19, 2007 I prefer GuiOnEventMode, because your script can get work done and is not trapped in the GuiGetMsg() loop: #include <GuiConstants.au3> Opt("GuiOnEventMode", 1) $hGUI = GUICreate("Test", 300, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") GUICtrlCreateLabel("Click the red X, I dare you!", 10, 10, 280, 20, $SS_CENTER) GUICtrlCreateButton("TEST", 100, 150, 100, 30) GUICtrlSetOnEvent(-1, "_ButtonHit") GUISetState() While 1 ; ; you can get work done here ; while waiting for events ; Sleep(20) WEnd Func _ButtonHit() MsgBox(16, "Stop Clicking Me!", "Who told you to mess with buttons?! Click the red X!") EndFunc ;==>_ButtonHit Func _Quit() ; Clean up stuff: ; writeLog("Quit program. Deleted temp files") ; FileClose($Name) ; FileClose($file) Exit EndFunc ;==>_Quit Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
The Ape Posted December 19, 2007 Posted December 19, 2007 I prefer GuiOnEventMode, because your script can get work done and is not trapped in the GuiGetMsg() loop:I agree. I just figured since Cambo wasn't aware of $GUI_EVENT_CLOSE... then "functions" weren't an option. FixJaw.comTriad-Art.com
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