Search code examples
c++wxwidgets

avoid windows resizing with double click


Related with this post

I tried to disable window resizing. So I disabled wxDEFAULT_FRAME_STYLE and wxRESIZE_BORDER options on my wxFrame... and it works.

But now, if user makes a double click over caption bar, the windows is resized again.

How could I avoid windows resizing when user make a double click over caption bar?

Thanks.


Solution

  • You need to remove the wxMAXIMIZE_BOX style.


    As per comments, you've been having problems doing this, or perhaps the wxWidgets that you are using does not map through to the underlying window style. If that is the case then you can remove the WS_MAXIMIZEBOX window style like this:

    DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
    SetWindowLongPtr(hwnd, GWL_STYLE, style & ~WS_MAXIMIZEBOX);