selfexploiter Posted May 2, 2005 Share Posted May 2, 2005 Hi,I'm trying to adapt the solution below for the Restore/Minimize/Maximize-Buttons (0xF020,0xF030,0xF120) in an external program. The commands seem to work at removing the items from the menus themselves, but it doesn't disable the actual icons. Interestingly enough, if the Close menu item is removed (like below), the × does get dimmed.How can I get this (the dimming) working for the other Buttons?Thank very much for helping in advance.LarsPlease post questions in the Support forum instead of Scripts and Scraps.But to answer your question:; Example of external programRun("calc")WinWait("Calculator")$calcHwnd = WinGetHandle("Calculator")$menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $calcHwnd, "int",0)DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", 0xF060, "int", 0x0);SC_CLOSE... Link to comment Share on other sites More sharing options...
CyberSlug Posted May 2, 2005 Share Posted May 2, 2005 Buttons are not grayed out, but they are disabled: Run("notepad") WinWait("Untitled - Notepad") $calcHwnd = WinGetHandle("Untitled - Notepad") Global Const $SC_CLOSE = 0xF060 Global Const $SC_MINIMIZE = 0xF020 Global Const $SC_MAXIMIZE = 0xF030; $menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $calcHwnd, "int",0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MINIMIZE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MAXIMIZE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_CLOSE, "int", 0x0) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
selfexploiter Posted May 2, 2005 Author Share Posted May 2, 2005 @CyberSlug Thank you for your reply! I was able to get it running on my machine. But my problem still remains. By googling the web i found following code snippet related to another scripting language. ;constants user32=StrCat(DirWindows(1),"user32.dll") WS_MAXIMIZEBOX=65536 GWL_STYLE=-16 ;remove maximize style oldstyle=DllCall(user32,long:"GetWindowLongA",long:handle,long:GWL_STYLE) newstyle=oldstyle & ~WS_MAXIMIZEBOX DllCall(User32,long:"SetWindowLongA",long:handle,long:GWL_STYLE,long:newstyle) Maybe this is the base for an AutoIt-Solution. But my knowledge is too little to adapt it by my self. In another thread i have found a similiar solution by Larry for an AutoIt-Gui-Project #include <GUIConstants.au3> Global $GWL_STYLE = -16 $hWnd = WinGetHandle("AutoIt Forums") $OldStyle = DLLCall( "user32.dll", "long", "GetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE ) If @error Then Exit $OldStyle = $OldStyle[0] $NewStyle = BitAND($OldStyle,BitNOT($WS_CAPTION) ) DLLCall( "user32.dll", "long", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "long", $NewStyle ) Sleep(2000) DLLCall( "user32.dll", "long", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "long", $OldStyle ) WinSetState($hWnd,"",@SW_MINIMIZE) WinSetState($hWnd,"",@SW_RESTORE) Is this a point to move on to reach the graying out of the controls in the titlebar? second problem: I have found out that disabled maximizing and restoring did not inhibit the resizing by doubleclick on the titlebar (e.g. IE 6). Is there a parameter preventing this? Thank you for your further comments Greetings Lars P.S. Please excuse my bad English. I know, i have to improve it urgently Link to comment Share on other sites More sharing options...
selfexploiter Posted May 2, 2005 Author Share Posted May 2, 2005 third question: Is it necessary to redraw the titlebar (user32.dll - DrawMenuBar) after changing the buttons? Greetings Lars Link to comment Share on other sites More sharing options...
Arnie Posted May 10, 2005 Share Posted May 10, 2005 (edited) Run("notepad") WinWait("Untitled - Notepad") $calcHwnd = WinGetHandle("Untitled - Notepad") Global Const $SC_CLOSE = 0xF060 Global Const $SC_MINIMIZE = 0xF020 Global Const $SC_MAXIMIZE = 0xF030; $menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $calcHwnd, "int",0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MINIMIZE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MAXIMIZE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_CLOSE, "int", 0x0) I can't get @CyberSlug's above code to work. All buttons are functional. Edited May 10, 2005 by Arnie Link to comment Share on other sites More sharing options...
DjDeep00 Posted July 11, 2006 Share Posted July 11, 2006 Run("notepad") WinWait("Untitled - Notepad") $calcHwnd = WinGetHandle("Untitled - Notepad") Global Const $SC_CLOSE = 0xF060 Global Const $SC_MINIMIZE = 0xF020 Global Const $SC_MAXIMIZE = 0xF030; $menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $calcHwnd, "int",0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MINIMIZE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MAXIMIZE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_CLOSE, "int", 0x0) I can't get @CyberSlug's above code to work. All buttons are functional. The above script works for the "close" button. How would you disable the "restore" button? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 11, 2006 Moderators Share Posted July 11, 2006 Run("notepad") WinWait("Untitled - Notepad") $calcHwnd = WinGetHandle("Untitled - Notepad") Global Const $SC_CLOSE = 0xF060 Global Const $SC_MINIMIZE = 0xF020 Global Const $SC_MAXIMIZE = 0xF030; Global Const $SC_RESTORE = 0xF120 $menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $calcHwnd, "int",0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MINIMIZE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MAXIMIZE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_CLOSE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_RESTORE, "int", 0x0) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
DjDeep00 Posted July 11, 2006 Share Posted July 11, 2006 Run("notepad") WinWait("Untitled - Notepad") $calcHwnd = WinGetHandle("Untitled - Notepad") Global Const $SC_CLOSE = 0xF060 Global Const $SC_MINIMIZE = 0xF020 Global Const $SC_MAXIMIZE = 0xF030; Global Const $SC_RESTORE = 0xF120 $menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $calcHwnd, "int",0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MINIMIZE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_MAXIMIZE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_CLOSE, "int", 0x0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", $SC_RESTORE, "int", 0x0) Same result, only the "close" button gets disabled. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 11, 2006 Moderators Share Posted July 11, 2006 (edited) It's disabling the Restore "Menu" not the button. Thus "RemoveMenu".Edit:Might want to look at SWP_NOMOVE / SWP_NOSIZE: http://msdn.microsoft.com/library/default....etwindowpos.aspEdit2:See above link, I gave the wrong one the first time.Edit3:I'm staying away from the computer today, that link has absolutely nothing to do with what your looking for!! Edited July 11, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
DjDeep00 Posted July 12, 2006 Share Posted July 12, 2006 It's disabling the Restore "Menu" not the button. Thus "RemoveMenu".Edit:Might want to look at SWP_NOMOVE / SWP_NOSIZE: http://msdn.microsoft.com/library/default....etwindowpos.aspEdit2:See above link, I gave the wrong one the first time.Edit3:I'm staying away from the computer today, that link has absolutely nothing to do with what your looking for!! Lol...anyone else..How to disable the "restore" button? Link to comment Share on other sites More sharing options...
DjDeep00 Posted July 24, 2006 Share Posted July 24, 2006 ...Someone please advise on how to disable the "restore" button on a window. 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