Chapter 12: Dialog-Based Windows Visual C++ and MFC Fundamentals
- In the constructor of the CMainFrame class, initialize the CFloatingSheet pointer
using the new operator:
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
Floater = new CFloaterDlg;
FSheet = new CFloatingSheet("Properties");
}
- On the CMainFrame::OnCreate() event, create and and display the property sheet
with the followsing:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
...
Floater->Create(IDD_DLG_FLOATER, this);
FSheet->Create(this,
WS_CHILD | WS_POPUP | WS_CAPTION |
WS_SYSMENU | WS_VISIBLE,
WS_EX_TOOLWINDOW);
return 0;
}
- Implement the OnViewFloating() event as follows:
void CMainFrame::OnViewFloating()
{
// TODO: Add your command handler code here
// Display the property sheet, even if it is already displaying
FSheet->ShowWindow(SW_SHOW);
}
- Test the application
- Return to MSVC