How To Create a Modeless CPropertySheet with Standard Buttons
SUMMARY
<script type="text/javascript">loadTOCNode(1, 'summary');</script>
This article describes how to implement the standard
OK,
Cancel, and
Apply buttons in a modeless
CPropertySheet object.
MORE INFORMATION
<script type="text/javascript">loadTOCNode(1, 'moreinformation');</script> For a modeless CPropertySheet, the Microsoft Foundation Classes (MFC) resize the sheet and hide the standard buttons in the CPropertySheet::OnInitDialog member function. To prevent MFC from doing this, perform the following steps:• | Derive a class from CPropertySheet and override the OnInitDialog function. |
• | Set "m_bModeless" to FALSE and remove the WF_CONTINUEMODAL style for "m_nFlags". |
• | Call CPropertySheet::OnInitDialog. |
• | Set "m_bModeless" back to TRUE and add the style WF_CONTINUEMODAL to "m_nFlags". |
// CMySheet is derived from CpropertySheet.
// Compile options needed: default.
BOOL CMySheet::OnInitDialog()
{
m_bModeless = FALSE;
m_nFlags |= WF_CONTINUEMODAL;
BOOL bResult = CPropertySheet::OnInitDialog();
m_bModeless = TRUE;
m_nFlags &= ~WF_CONTINUEMODAL;
return bResult;
}