Adding the Minimize Window to the MFC Property Sheet System Menu

How can I add Minimize and Maximize to the system menu CMFCPropertySheet. I tried to change the style

CMFCPropertySheet::ModifyStyle(NULL, WS_SYSMENU);

but nothing happened.

+5
source share
1 answer

Assuming you have a class derived from CPropertySheet, call it in MySheet:

// Capture the WM_NCREATE message
BEGIN_MESSAGE_MAP(CMySheet, CPropertySheet)
  ON_WM_NCCREATE()
END_MESSAGE_MAP()

BOOL CMySheet::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
{
  if (!CPropertySheet::OnNcCreate(lpCreateStruct))
    return FALSE;

  // Modify the window style
  LONG dwStyle = ::GetWindowLong(m_hWnd, GWL_STYLE);
  ::SetWindowLong(m_hWnd, GWL_STYLE, dwStyle | WS_WS_MINIMIZEBOX | WS_MAXIMIZEBOX);

  return TRUE;
}

Note that you can do this in OnInitDialog, but even if the Minimize / Maximize fields appear, they won’t do anything.

+6
source

All Articles