Disable Window Resizing Win32

If you use WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU, it disable both maximizing and resizing.


You can use WS_OVERLAPPEDWINDOW ^ WS_THICKFRAME

The XOR will keep everything in WS_OVERLAPPEDWINDOW except for WS_THICKFRAME


You can try something like this:

::SetWindowLong(hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE)&~WS_SIZEBOX);

It only disable resizing by dragging the edge of windows. By the way, WS_SIZEBOX is the same as WS_THICKFRAME because of

#define WS_SIZEBOX WS_THICKFRAME

The WS_OVERLAPPEDWINDOW style includes the WS_THICKFRAME style which, I think, is responsible for making your window resizeable.

Consider something like

dwStyle=(WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);

Tags:

C++

Winapi

Resize