Windows – How to disable Windows 7 feature that maximizes a window to full screen when moved to the edge of the screen (but keep keyboard shortcuts working)

aero-snapwindows 7

I followed this advice:
How to disable auto-maximize/resize window (aero-snap) when near screen edge?

But it also turns off the feature where pressing WinKey + Left/Right Arrow, fit the windows to half of the screen on the direction of the arrow key.

Is there a way to control them independently?

Best Answer

Though there may not be a way to do this through a GUI there is a way to accomplish it programmatically.

The function you want is SystemParametersInfo. You can read about it on MSDN if you want it's full capability (it's can access an absurd number of settings) but you'll be interested in SPI_SETDOCKMOVING and SPI_SETSNAPSIZING.

SPI_SETDOCKMOVING toggles the ability to snap windows by dragging them by their title bars. You can turn it off like this:

SystemParametersInfo(SPI_SETDOCKMOVING, 0, NULL, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE)

SPI_SETSNAPSIZING toggles the ability to snap windows by sizing them using their top and bottom borders. You can turn it off like this:

SystemParametersInfo(SPI_SETSNAPSIZING, 0, NULL, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE)

To turn either back on just make the same call with a non-zero number for the second argument. To make the changes not persist after a reboot remove the SPIF_UPDATEINIFILE flag from the last argument.

To ensure you keep your keyboard shortcuts do not to turn AeroSnap off in the Control Panel or registry.

The diligent may notice that the arguments supplied here are not what you might expect them to be from the documentation. Specifically the pvParam and uiParams are switched. This is the only way I have found to make this function work on my machine (running Windows 8.1) so I suspect an error in the docs.