views:

21

answers:

1

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?

+1  A: 

Have you tried ::ShowWindow( SW_SHOWNORMAL ); ?

Kirill V. Lyadvinsky
@Kirill: Yes I have tried `::ShowWindow(SW_SHOWNORMAL)` but it resizes and repositions the window to its "original" startup size, and I want it to size to my specs.
fred.bear