After SetWindowPos( hwnd, HWND_NOTOPMOST, x, y, cx, cy, SWP_SHOWWINDOW)
, a window whose state was previously maximized, does resize and reposition itself as expected, but the system menu does not change, and still presents the menu items for a "currently-maximized" window, even though it is no longer maximized.
Following up with PostMessage( hwnd, WM_SYSCOMMAND, SC_RESTORE, 0)
gets the system-menu looking right again, but it seems that I am mixing two themes here, and that posting SC_RESTORE
is overkill, as this is already the window's state.
Is there a single command which resizes and repositions a window, and also sets the system menu to reflect a new max/min/res window state?