Handling AeroSnap message in WndProc

I’m guessing there aren’t any special messages here; Aero is likely just using the plain Win32 APIs – ShowWindow(SW_MAXIMIZE) and similar.

The thing to uderstand with the SC_ messages are that those are requests from a menu asking the window to resize/restore/etc itself, but that is not the only mechanism for changing the windows’s size. What’s probably happening is that when a window gets SC_MAXIMIZE, the DefWndProc implements this by calling ShowWindow(SW_MAXIMIZE).

Your best best is to listen to the WM_SIZE message, which the window receives, regardless of what triggered the size change: system menu, API, or other means. In particular, the lParam will let you know if the window was maximized (SIZE_MAXIMIZED) or restored (SIZE_RESTORED).

Leave a Comment