Skip to main content

Remove MAXIMIZE BOX and MINIMIZE BOX from an MFC Window

· One min read

In order to remove MAXIMIZE BOX and MINIMIZE BOX from an MFC Window see the below code snippet.

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;

cs.dwExStyle &= ~WS\_EX\_CLIENTEDGE;
cs.lpszClass = AfxRegisterWndClass(0);

//////////////////////////////////////////////////////////
// To remove MAXIMIZE BOX from window //
//////////////////////////////////////////////////////////
cs.style &= ~WS\_MAXIMIZEBOX;

//////////////////////////////////////////////////////////
// To remove MINIMIZE BOX from window //
//////////////////////////////////////////////////////////
cs.style &= ~WS\_MINIMIZEBOX;

return TRUE;
}