WinMinimize behavior isn't correct

164 Views Asked by At

I'm using WinMinimize in my script to minimize various windows to the taskbar

The default behavior for minimization is minimize to the taskbar. But some programs are set to minimize to the tray. They minimize to the tray when the minimize button on the program's window is pressed, but when WinMinimize command is used to minimize that program's window it gets minimized to the taskbar instead to the tray.

Any solutions to this problem?

Edit: I'm testing it on Windows 7.

1

There are 1 best solutions below

2
On

AHK's WinMinimize maps to the WinAPI function to minimize window. It bypasses any custom handling the application might have implemented (e.g. minimize to tray).

To simulate click on the minimize button, one has to send to the window the WM_SYSCOMMAND message with parameter SC_MINIMIZE. (The names of the constants are unknown to AHK: you have to use the numeric values specified in the documentation.)

For example (tested on Win7/x64) to send the minimize message to active window using the Win-H shortcut:

#h::PostMessage, 0x112, 0xF020, 0, , A

See PostMessage documentation for more info.