[Script] enlarge any window at "maximize" to max size to remain moveable on multiple monitors

Post your working scripts, libraries and tools
pramach
Posts: 39
Joined: 24 Jan 2018, 08:20

[Script] enlarge any window at "maximize" to max size to remain moveable on multiple monitors

30 Jan 2018, 03:07

Hi
When maximize a window it can - under some circumstances - no longer be moved from one monitor to another.
At least this what I discovered in Win10.

The following script solved this by:
- work on any single window of any application
- check constantly if a window is maximized
- undo the maximize but extend the window to full screen width & height
- "maximize" a such full screen window will normalize the window back to size fefore first "maximize" action was triggered
- Same behaviour if you click on the maximize icon in the title bar or doubleclick on the titlebar
- Maximize a window keep the window at the current monitor
- Undo the maximize also keep the window at the current monitor

The script has been tested with 2 monitors of same size & resolution. It has been tested on a variety of applications like IE, Edge, MS Office, Notepad++, Total Comander, and several more.

During development, I get various help here in the forum. Thanks for !

Enjoy

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

pramach
Posts: 39
Joined: 24 Jan 2018, 08:20

Re: [Script] enlarge any window at "maximize" to max size to remain moveable on multiple monitors

30 Jan 2018, 06:00

Hi
In case your max size window is too high, you can reduce the height by simple add an additional reduction when doing the move

Code: [Select all] [Download] GeSHi © Codebox Plus

			; check which monitor it's on (SysGet) and move (WinMove)
sysGet, mon, monitor, % winMonitorNbr
winMoveSmooth( hwnd, monLeft, monTop, monRight - monLeft, monBottom - monTop - 40 )

In the example above I reduce the height by additional 40 pixels.
SvenBent
Posts: 257
Joined: 09 Aug 2015, 01:34

Re: [Script] enlarge any window at "maximize" to max size to remain moveable on multiple monitors

07 Feb 2018, 08:23

I would avoid using a check interval
1: It gobles up unneeded CPU power ( even though its very little)
2: it creates a delay for the effect to kick in. in this case up to a second.

To eliminate these two you should be using a shellhook instead
https://autohotkey.com/board/topic/8064 ... -messages/
This way you program reacts immediately on the maximize windows command.
pramach
Posts: 39
Joined: 24 Jan 2018, 08:20

Re: [Script] enlarge any window at "maximize" to max size to remain moveable on multiple monitors

08 Feb 2018, 01:57

Hmmmm

Hi Sven
I made some very simple tryouts

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


As you can see, nothing special

When started, I get randomly the msgbox with wParam 2 and 6, without the if statement also 32337.
I say randomly, because I do not get it always when I maximize a window and I never get any when I normalize a window.
However I get a 2 when I change something inside a window ....

Win10, 64 bit

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Reynbow, songdg and 13 guests