Burkhard
Burkhard

Reputation: 14738

How to disable resizeing of a window with autohotkey?

I wrote a script with autohotkey, that keeps the clicked window always on top

~MButton::
CoordMode, Mouse, Window
MouseGetPos, ClickX, ClickY, WindowUnderMouseID
WinActivate, ahk_id %WindowUnderMouseID%
WinGetClass, class, A
MouseGetPos, ClickX, ClickY, WindowUnderMouseID
WinGetPos, x, y, w, h, ahk_id %WindowUnderMouseID%

; check if title bar, with an exception for Firefox with tabs in title bar that can be middle-clicked to close
if (ClickX < w and ClickY < 24 and ClickY > 0 and ClickX > 0 and class != "MozillaWindowClass")
{
    WinSet, AlwaysOnTop, Toggle, A
}
Return

Now I want to modify this script to disable the possibility of the window to be resized. I found something with Gui, -resize but I don't see how this would help. Replacing the AlwaysOnTop with resize does not work (Parameter #1 is invalid).

How can I achieve the desired funktionality?

Upvotes: 0

Views: 801

Answers (1)

Elliot DeNolf
Elliot DeNolf

Reputation: 2999

After a quick search, I found the following line of code that disables the resize

WinSet, Style, -0x40000, A

In your case, you would swap out A for your %WindowUnderMouseID%

Upvotes: 1

Related Questions