class CPage1 : public CPropertyPage
{
DECLARE_DYNCREATE(CPage1)
// Construction
public:
CPage1();
~CPage1();
// Dialog Data
//{{AFX_DATA(CPage1)
enum { IDD = IDD_PAGE1 };
..
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CPage1)
public:
virtual BOOL OnSetActive();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
..
};
BOOL CPage1::OnSetActive()
{
((CPropertySheet *)GetParent())->SetWizardButtons(PSWIZB_NEXT);
return CPropertyPage::OnSetActive();
}
class CPage2 : public CPropertyPage
{
DECLARE_DYNCREATE(CPage2)
// Construction
public:
CPage2();
~CPage2();
// Dialog Data
//{{AFX_DATA(CPage2)
enum { IDD = IDD_PAGE2 };
..
//}}AFX_DATA
..
};
BOOL CPage2::OnSetActive()
{
((CPropertySheet *)GetParent())->SetWizardButtons(PSWIZB_BACK|PSWIZB_NEXT);
return CPropertyPage::OnSetActive();
}
class CPage3 : public CPropertyPage
{
DECLARE_DYNCREATE(CPage3)
// Construction
public:
CPage3();
~CPage3();
// Dialog Data
//{{AFX_DATA(CPage3)
enum { IDD = IDD_PAGE3 };
..
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CPage3)
public:
virtual BOOL OnSetActive();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
..
};
BOOL CPage3::OnSetActive()
{
((CPropertySheet *)GetParent())->SetWizardButtons(PSWIZB_BACK|PSWIZB_FINISH);
return CPropertyPage::OnSetActive();
}
class CSheetDlg : public CPropertySheet
{
DECLARE_DYNAMIC(CSheetDlg)
// Construction
public:
CSheetDlg(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
CSheetDlg(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
CPage1 m_page1;
CPage2 m_page2;
CPage3 m_page3;
..
};
CSheetDlg::CSheetDlg(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
AddPage(&m_page1);
AddPage(&m_page2);
AddPage(&m_page3);
}
CSheetDlg::CSheetDlg(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
AddPage(&m_page1);
AddPage(&m_page2);
AddPage(&m_page3);
}
void CPropertyView::OnWizard()
{
CSheetDlg dlg(IDS_SHEET);
dlg.SetWizardMode( );
if(dlg.DoModal() == ID_WIZFINISH)
{
.. dlg.m_page1 .. dlg.m_page2 .. dlg.m_page3 ..
}
}
1. 위저드 페이지를 위한 다이얼로그 리소스를 만든다.