Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 12: Dialog-Based Windows


*/
CFloatingSheet::CFloatingSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT
iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
AddPage(&pgSmall);
AddPage(&pgMedium);
}

CFloatingSheet::~CFloatingSheet()
{
}

BEGIN_MESSAGE_MAP(CFloatingSheet, CPropertySheet)
ON_WM_CLOSE()
END_MESSAGE_MAP()

// CFloatingSheet message handlers

void CFloatingSheet::OnClose()
{
// TODO: Add your message handler code here and/or call default
ShowWindow(FALSE);

// CPropertySheet::OnClose();
}


  1. Display the IDR_MAINFRAME menu and, under the Floater menu item of the View
    menu, add a new item with a caption of Fl&oating and press Enter

  2. Right-click the Floating menu item and click Add Event Handler...

  3. Accept the Message type as COMMAND. Accept the suggested Function Handler
    Name. In the Class List, click CMainFrame then click Add and Edit

  4. Access the MainFrm.h header file. Then, declare a pointer to the property sheet class
    and name it Fsheet:


// MainFrm.h : interface of the CMainFrame class
//
#pragma once
#include "FloaterDlg.h"
#include "FoatingSheet.h"

class CMainFrame : public CFrameWnd
{

protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)

// Attributes
public:

// Operations
public:
CFloaterDlg *Floater;
CFloatingSheet *FSheet;
Free download pdf