Maximize window anomaly
Posted: 27 Jan 2016, 15:32
This is probably not an AutoHotkey bug but I can't be certain. I also am not sure that this is not just me or my PC.
The Problem
The "gui Maximize" command sometimes sizes the window larger that the monitor work area which is the size of the monitor less the taskbar and other registered desktop toolbars. Specifically, the problem occurs when "gui Maximize" command is used on a window where the MaximizeBox button has been disabled.
Example
Here is a script that demonstrates the problem. Instructions are included at the top.
Help
First of all, I just want to verify that this problem is occurring outsize of my PC. Secondly, I'm running Windows 7, SP1. I'm curious if this is just a Windows 7 issue or whether it occurs on the more recent versions of Windows.
If you run the test, post if you experienced the problem or not and let me know what version of Windows you have. Thanks.
The Problem
The "gui Maximize" command sometimes sizes the window larger that the monitor work area which is the size of the monitor less the taskbar and other registered desktop toolbars. Specifically, the problem occurs when "gui Maximize" command is used on a window where the MaximizeBox button has been disabled.
Example
Here is a script that demonstrates the problem. Instructions are included at the top.
Code: Select all
/*
Instructions:
Run 2 tests.
1st test. Comment out the "-MaximizeBox" option (may already
commented out) so that the MaximizeBox button will show. Run the
script. Maximize the window. Note the value of A_GUIHeight. You
should be able to see the text control at the bottom of the
maximized window.
2nd test. Uncomment the "-MaximizeBox" option so that the
MaximizeBox button is hidden. Run the script. Press F11 to
maximize the window. Note the value of A_GUIHeight. If the
"gui Maximize" command is over-sizing the window, you will not
be able to see the text control at the bottom of the maximized
window assuming that your PC is showing a taskbar at the bottom of
the monitor.
*/
#NoEnv
#SingleInstance Force
Loop 200
List.=(A_Index>1 ? "`n":"") . A_Index
gui -DPIScale +hWndhWindow +Resize ;-MaximizeBox
GroupAdd MyWindowGroup,ahk_id %hWindow%
gui Margin,0,0
gui Add,Edit,w350 r10 vMyEdit
gui Add,Text,h20 vMyText,Text control - 20 pixels high
gui Show
GUIControl,,MyEdit,%List%
return
GUISize:
$Maximized:=(A_EventInfo=2) ? True:False
GUIControl Move,MyEdit,% "w" . A_GUIWidth . " h" . A_GUIHeight-20
GUIControl Move,MyText,% "y" . A_GUIHeight-20
outputdebug A_GUIHeight=%A_GUIHeight%
if $Maximized
{
gui +OwnDialogs
MsgBox A_GUIHeight=%A_GUIHeight%
}
return
GUIClose:
GUIEscape:
ExitApp
#IfWinActive ahk_group MyWindowGroup
F11::
if $Maximized
gui Restore
else
gui Maximize
return
#IfWinActive
First of all, I just want to verify that this problem is occurring outsize of my PC. Secondly, I'm running Windows 7, SP1. I'm curious if this is just a Windows 7 issue or whether it occurs on the more recent versions of Windows.
If you run the test, post if you experienced the problem or not and let me know what version of Windows you have. Thanks.