I made an overlapped window that has its maximize button greyed out. I want the window to be always maximized, to disable moving or resizing at all times, so I added ShowWindow(mainwindow, SW_MAXIMIZE).
The latter doesn't seem to work. The window does not completely fill the screen (though it's close) and I can still drag it around by the title bar.
However, when I add the WS_MAXIMIZEBOX style, ShowWindow(mainwindow, SW_MAXIMIZE) does do its job properly (complete maximize and disable moving by dragging), but now the maximize button is not greyed out, so the user can resize the window that way.
Just remove maximize button after you call ShowWindow:
1 2 3
LONG_PTR Style = GetWindowLongPtr(windowHandle, GWLP_STYLE);
Style &= ~WS_MAXIMIZEBOX; //this makes it still work when WS_MAXIMIZEBOX is actually already toggled off
SetWindowLongPtr(windowHandle, GWLP_STYLE, Style);
Alternatively, leave the button there, but block the event from your window procedure.