 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Mustang
Joined: 17 May 2007 Posts: 375 Location: England
|
Posted: Sat Jan 19, 2008 2:05 pm Post subject: Get Windows Maximize State From Its System Menu |
|
|
Can anyone see why this isn't working?
| Code: | Sleep, 3000
WinGet, WindowID, ID, A
SystemMenuHandle := DllCall( "GetSystemMenu", "UInt", WindowID, "UInt", (NULL:=0) )
VarSetCapacity( MenuItemInfo, 48, 0 )
NumPut( 48, MenuItemInfo, 0 )
NumPut( (MIIM_STATE:=1), MenuItemInfo, 4 )
DllCall( "GetMenuItemInfo", "UInt", SystemMenuHandle, "UInt", (SC_MAXIMIZE:=0xF030), "UInt", (NULL:=0x0), "UInt", &MenuItemInfo )
MsgBox, % NumGet( MenuItemInfo, 12 ) |
|
|
| Back to top |
|
 |
Guest
|
Posted: Sat Jan 19, 2008 7:02 pm Post subject: |
|
|
For some reason I can access the System menu only once while it is still open,after close and reopen the window the menu is accessible again.
I was running this code to test:
| Code: | win := "some window"
msgbox, % DllCall("GetMenuItemCount", "UInt", DllCall("GetSystemMenu", "Int", WinExist(win), "Int", 0))
;the result should be 7
|
|
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2558 Location: Australia, Qld
|
Posted: Sun Jan 20, 2008 2:24 am Post subject: |
|
|
| Mustang wrote: | | Get Windows Maximize State From Its System Menu | Why do things the hard way?
| WinGet wrote: | MinMax: Retrieves the minimized/maximized state for a window. OuputVar is made blank if no matching window exists; otherwise, it is set to one of the following numbers:
-1: The window is minimized (WinRestore can unminimize it).
1: The window is maximized (WinRestore can unmaximize it).
0: The window is neither minimized nor maximized. |
|
|
| Back to top |
|
 |
Mustang
Joined: 17 May 2007 Posts: 375 Location: England
|
Posted: Sun Jan 20, 2008 4:22 am Post subject: |
|
|
Not so much the hard way
But something completely different to MinMax
WinMaximize will maximize a window even if it isn't "allowed" to be maximized
e.g. The Maximize button or menu item is disabled/greyed
So as a work around I'm trying to get the state of the Maximize menu item
When the window is in a restore mode
In order to determine if it should be maximized or not
Hope this clears it up enough to be of help |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2558 Location: Australia, Qld
|
Posted: Sun Jan 20, 2008 4:33 am Post subject: |
|
|
I'm not sure why the system menu behaves the way it does, but I think you can get around the problem using WinGet:
| Code: | WinGet, style, Style, A
if (style & 0x10000) ; WS_MAXIMIZEBOX
MsgBox this window can be maximized
else
MsgBox this window cannot be maximized |
|
|
| Back to top |
|
 |
Mustang
Joined: 17 May 2007 Posts: 375 Location: England
|
Posted: Sun Jan 20, 2008 4:41 am Post subject: |
|
|
That seams to have worked on the examples I've tried so far
Thanks lexikos |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|