Page 1 of 1

AHK still thinks window is maximized

Posted: 23 Mar 2018, 15:54
by KilliK
Hello.

My monito's native resolution is 2K and it's the one I am using for almost all my games.
But sometimes there are games which I need to play in a lower fullscreen resolution, ie 1080p.
When I exit those games, the windows which I had already opened before I started the game, appear out of place and smaller. something like this:

Image

I read in the web that this is a common behavior from Windows, they change the desktop resolution when you change the in-game fullscreen resolution and this affects the position of the opened windows.

Now here is the problem with AHK. It still thinks that the windows are maximized and the WinMaximize command wont maximized them. Which is normal since the WinGet minmax command shows that the window is indeed maximized.
My question is how can I fix this? How can I make AHK to realize that the window is not actually maximized in such situations, and force it to maximize and cover the entire monitor as it should be?

Re: AHK still thinks window is maximized

Posted: 23 Mar 2018, 16:38
by Xtra
Use WinRestore before trying to minimize/maximize.

HTH

Re: AHK still thinks window is maximized

Posted: 23 Mar 2018, 21:08
by KilliK
thanks that did it but how can I trigger the command when this happens? the WinGet is not reliable since the window still has the maximized flag.

Re: AHK still thinks window is maximized

Posted: 23 Mar 2018, 21:14
by Xtra
Could use WinGetPos to check width/height and then act on it.

Re: AHK still thinks window is maximized

Posted: 24 Mar 2018, 00:08
by lexikos
A window's minimized or maximized state is independent from its size. AutoHotkey tells you the window is maximized because the window really is in that state, which is also reflected by the maximize/restore button showing the icon for restore, not maximize, and restoring the window when clicked.

If you want to detect whether the window fills the screen, WinGetPos is the correct choice. If you just want to make it fill a certain area (or the whole screen), you can just use WinMove, leaving it in the maximized state.