1
votes

I'm maintaining a classic MDI MFC application, and I'd like to prevent the user from minimizing an MDI document window.

The best solution would be if I just could remove or disable the "Minimze" button from the MDI Window and remove/disable the "Minimize" command from the menu that shows up when you click on the upper left corner of the MDI window.

enter image description here

1
Using the Multiple Document Interface: Creating a Child Window: "To create an MDI child window that can have any combination of window styles, specify the MDIS_ALLCHILDSTYLES window style. When this style is not specified, an MDI child window has the WS_MINIMIZE, WS_MAXIMIZE, WS_HSCROLL, and WS_VSCROLL styles as default settings."IInspectable

1 Answers

2
votes

Override PreCreateWindow from CChildFrame, and write:

BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
  // TODO: Modify the Window class or styles here by modifying
  //  the CREATESTRUCT cs

  cs.style &= ~WS_MINIMIZEBOX;

  if(! CMDIChildWnd::PreCreateWindow(cs))
      return FALSE;

  return TRUE;
}