How to prevent window resizing temporarily?

c++, resize, winapi, windows

Solution

One way is to use GetWindowLong() with `GWL_STYLE` flag to get the window style and reset/remove any styles you need, ie the `WS_THICKFRAME` style so that the window can't be resized.

You apply the new style with SetWindowLong.

Problem

I have a window which can be resized, but there are some situations when resizing is not possible because of the application state. Is there a way to prevent resizing the window temporarily? I want to disable resizing by all means available to the users, which include window menu, dragging edges by mouse, user initiated window tiling performed by OS - and perhaps some other I am not aware of?

Original source