Ivan808 Posted December 5, 2009 Share Posted December 5, 2009 Hello, I know this is probably a VERY small and simple script. I just cant find what I am looking for. I found Winclose in the help file and of course exit. But neither is what i am looking for. I am trying to be able to have it where I can click the "X" at the top right hand of the window and it will not close out or exit the subform (maybe there is a way to make it where it Show.Hide it?). I have it where the main form is shown at all times, unless of course the user clicks on the "X" Anyone know how to do this? Ivan Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 5, 2009 Share Posted December 5, 2009 An AutoIt GUI doesn't close when you click "X". It just sends the $GUI_EVENT_CLOSE message to GuiGetMsg(). If your message loop doesn't do anything with that, then nothing happens when you click it. Find the part of your loop that looks like this: $msg = GuiGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $SomeOtherButton _DoSomethingElse() EndSwitch Just take out/change the action for $GUI_EVENT_CLOSE. 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 Link to comment Share on other sites More sharing options...
Ivan808 Posted December 5, 2009 Author Share Posted December 5, 2009 (edited) An AutoIt GUI doesn't close when you click "X". It just sends the $GUI_EVENT_CLOSE message to GuiGetMsg(). If your message loop doesn't do anything with that, then nothing happens when you click it. Find the part of your loop that looks like this: $msg = GuiGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $SomeOtherButton _DoSomethingElse() EndSwitchJust take out/change the action for $GUI_EVENT_CLOSE. This is what I have:Case -3 Exitso I should change this back to $GUI_EVENT_CLOSE huh?-------------EDIT---------------OUTSTANDING, it WORKS!I did this for anyone interested:Case $GUI_EVENT_CLOSE GUISetState(@SW_HIDE, $a) GUISetState(@SW_HIDE, $b) GUISetState(@SW_HIDE, $c) GUISetState(@SW_HIDE, $d) GUISetState(@SW_HIDE, $e) GUISetState(@SW_HIDE, $f) GUISetState(@SW_SHOW, $Main_script)This event upon clicking the "X" at the top, will hide all subforms currently open and will make sure that the main form is shown.Thanks again! Edited December 5, 2009 by Ivan808 Link to comment Share on other sites More sharing options...
KaFu Posted December 5, 2009 Share Posted December 5, 2009 (edited) And if you're in GuiEvent mode and stuck in a function... refer to Intercept WM_CLOSE ... Edited December 5, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) 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