How do you disable the Maximize button in MFC?

2019-06-26 04:54发布

问题:

How do you disable the Maximize button/capability in an SDI application?

回答1:

For completeness:

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    ModifyStyle(WS_MAXIMIZEBOX, 0);

    <etc...>
}


回答2:

ModifyStyle(WS_MAXIMIZEBOX,0,SWP_FRAMECHANGED);  // disable maximize
ModifyStyle(WS_MINIMIZEBOX,0,SWP_FRAMECHANGED);  // disable minimize
ModifyStyle(0,WS_MAXIMIZEBOX,SWP_FRAMECHANGED);  // enable maximize
ModifyStyle(0,WS_MINIMIZEBOX,SWP_FRAMECHANGED);  // enable minimize

try this, should be working



回答3:

You can see it here: How to disable maximize in SDI application