mike2003 Posted August 13, 2016 Share Posted August 13, 2016 (edited) i have some code GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = .... When i press ESC - window close IF i delete Case $msg = $GUI_EVENT_CLOSE ExitLoop i cant close window even with mouse click How disable ESC button?? Edited August 13, 2016 by mike2003 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 13, 2016 Moderators Share Posted August 13, 2016 mike2003, Opt("GUICloseOnESC", 0) should do the trick. M23 mike2003 and behdadsoft 2 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mike2003 Posted August 13, 2016 Author Share Posted August 13, 2016 Yes. Thanks Link to comment Share on other sites More sharing options...
mike2003 Posted August 18, 2016 Author Share Posted August 18, 2016 Can i reprogram the button for minimize window? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 18, 2016 Moderators Share Posted August 18, 2016 Define "reprogram". Are you looking to remove it, ignore it, or change the behavior? And if the last, what are you looking for that behavior to be? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jguinch Posted August 18, 2016 Share Posted August 18, 2016 Maybe you can use $GUI_EVENT_MINIMIZE in your main loop, or use GUIRegisterMsg with WM_SYSCOMMAND, for example : #Include <GUIConstantsEx.au3> #Include <WindowsConstants.au3> #Include <MenuConstants.au3> Opt("GUICloseOnESC", 0) Local $hGui = GUICreate("My GUI") GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_SYSCOMMAND($hWndGUI, $MsgID, $WParam, $LParam) Switch $WParam Case $SC_MINIMIZE MsgBox(0, "", "Minimize button was clicked", 0, $hGui) Return 0 EndSwitch Return $GUI_RUNDEFMSG EndFunc Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 18, 2016 Moderators Share Posted August 18, 2016 mike2003, Perhaps this is close to what you require: #Include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TrayConstants.au3> Opt("GUICloseOnESC", 0) Opt("GUIEventOptions", 1) Opt("TrayMenuMode", 3) $cTrayShow = TrayCreateItem("Restore GUI") TrayItemSetState($cTrayShow, $TRAY_DISABLE) TrayCreateItem("") $cTrayExit = TrayCreateItem("Exit") Local $hGui = GUICreate("My GUI", 500, 500, Default, Default, BitOr($WS_SYSMENU, $WS_CAPTION)) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE WinSetState($hGui, "", @SW_MINIMIZE) TrayItemSetState($cTrayShow, $TRAY_ENABLE) EndSwitch Switch TrayGetMsg() Case $cTrayExit Exit Case $cTrayShow WinSetState($hGui, "", @SW_RESTORE) TrayItemSetState($cTrayShow, $TRAY_DISABLE) EndSwitch WEnd The [X] minimises the GUI and the tray menu restores it. Please ask if you have any questions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
spudw2k Posted August 18, 2016 Share Posted August 18, 2016 @Melba23 I always liked programs that use that feature (minimize to systray) and additionally hide the taskbar icon as well. This can be achieved by changing @SW_MINIMIZED to @SW_HIDE in your demo script. I'm sure you knew that...just wanted to point it out for other readers. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
mike2003 Posted August 18, 2016 Author Share Posted August 18, 2016 (edited) I think you misunderstood me. Now button ESC does not close the window, but I want to make it minimized when ESC press. Something like $GUI_EVENT_CLOSE but for minimize for ESC ) Edited August 18, 2016 by mike2003 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 19, 2016 Moderators Share Posted August 19, 2016 mike2003, To do that I would use an Accelerator key - like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $hGui = GUICreate("My GUI", 500, 500, Default, Default, BitOR($WS_SYSMENU, $WS_CAPTION)) $cMinimiseDummy = GUICtrlCreateDummy() Local $aAccelKeys[1][2] = [["{ESC}", $cMinimiseDummy]] GUISetAccelerators($aAccelKeys) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cMinimiseDummy WinSetState($hGui, "", @SW_MINIMIZE) EndSwitch WEnd spudw2k, I did know about @SW_HIDE removing the icon from the taskbar, but thanks for reminding others. M23 mike2003 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mike2003 Posted August 19, 2016 Author Share Posted August 19, 2016 that's what I need 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