79667696

Date: 2025-06-16 13:23:57
Score: 2
Natty:
Report link

After a bit of playing around with the code provided by @adrid, I was able to resolve it by simply stripping WS_THICKFRAME and WS_MAXIMIZEBOX from the Window style.

If WS_BORDER is also stripped, the window can't have a title bar which is not explicitly stated in the documentation. Below shows a before and after.

Window with WS_BORDER style stripped.

Window with WS_BORDER style not stripped.

Final Code:

void windowSetResizable(Window* window, bool canResize) {
    InternalWindow* internalWindow = getInternalWindow(window);
    int style = GetWindowLongPtr(internalWindow->handle, GWL_STYLE);

    if (!canResize) {
        style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
    } else {
        style |= (WS_THICKFRAME | WS_MAXIMIZEBOX);
    }
    SetWindowLongPtrA(internalWindow->handle, GWL_STYLE, style);
    
    SetWindowPos(internalWindow->handle, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
}
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @adrid
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: xKaihatsu