ReaImDown Posted May 25, 2008 Posted May 25, 2008 how would I disable it in a window...say on firefox... also, how could I disable it in a GUI (made by the running program.) [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Richard Robertson Posted May 25, 2008 Posted May 25, 2008 You can't exactly disable it, per se. You need access to the closing window message. You return a cancel value to the operating system and you have effectively canceled the closing of the window. You could also mess with styles and remove the buttons completely.
rasim Posted May 25, 2008 Posted May 25, 2008 (edited) ReaImDownTry this:expandcollapse popup#include <GuiMenu.au3> HotKeySet("^d", "_CloseButton_Disable") HotKeySet("^e", "_CloseButton_Enable") HotKeySet("{ESC}", "_Exit") $title = "[Class:Notepad]" Run("notepad.exe") WinWait($title) Global $hWnd = WinGetHandle($title) Global $hWndPrevious While 1 Sleep(100) WEnd Func _CloseButton_Disable() Local $hMenu = _GUICtrlMenu_GetSystemMenu($hWnd) If $hMenu = $hWndPrevious Then Return False _GUICtrlMenu_RemoveMenu($hMenu, 6, True) _GUICtrlMenu_RemoveMenu($hMenu, 5, True) _GUICtrlMenu_DrawMenuBar($hMenu) WinSetState($hWnd, "", @SW_HIDE) WinSetState($hWnd, "", @SW_SHOW) $hWndPrevious = $hMenu EndFunc Func _CloseButton_Enable() Local $hMenu = _GUICtrlMenu_GetSystemMenu($hWnd, True) If $hMenu = $hWndPrevious Then Return False WinSetState($hWnd, "", @SW_HIDE) WinSetState($hWnd, "", @SW_SHOW) $hWndPrevious = $hMenu EndFunc Func _Exit() If WinExists($hWnd) Then WinClose($hWnd) Exit EndFunc Edited May 25, 2008 by rasim
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