1
votes

I have an AutoHotkey script that launches an application maximized like this:

`Run, myprogram.exe,, Max`

It then gets rid of the minimize and restore buttons. I can still click on the task bar and drag downwards to restore the window. Is there any good way to keep my window maximized in AHK? How about just locking the window's position?

1
Use WINAPI CBTHook (example) and return 1 to prevent HCBT_MOVESIZE operation if the window handle matches. It might take you a while to get things done but this method seems the most reliable one.wOxxOm

1 Answers

1
votes

Does the F11 key maximize the app? When in F11 mode most apps completely lose their title bar.
If so, run the app then send an F11 key (You may need to wait a bit for the app to be active or something).
Failing that, yes you could have an infinite loop running that monitored the window position / size (WinGetPos) and if it was not at 0,0 and the size of the screen (A_ScreenWidth, A_ScreenHeight), then move it to that position and size (WinMove).