virtual BOOL OnWizardFinish( );
Return Value
Nonzero if the property sheet is destroyed when the wizard finishes; otherwise zero.
Remarks
This member function is called by the framework when the user clicks on the Finish button in a wizard. When the framework calls this function, the property sheet is destroyed when the Finish button is pressed and OnWizardFinish returns TRUE ( a nonzero value).
Override this member function to specify some action the user must take when the Finish button is pressed. When overriding this function, return FALSE to prevent the property sheet from being destroyed.
For more information about notification messages sent when the user presses the Finish button in a wizard property sheet, see PSN_WIZFINISH in the Win32 documentation.
For more information on how to make a wizard-type property sheet, see CPropertySheet::SetWizardMode.
Example
// Inform users regarding the selections they have made by
// navigating the pages in propertysheet.
BOOL CColorPage::OnWizardFinish()
{
CString report = "You have selected the following options:\n";
// Get the number of property pages from CPropertySheet.
CPropertySheet* sheet = (CPropertySheet*) GetParent();
int count = sheet->GetPageCount();
// Get the formatted string from each page. This formatted string
// will be shown in a message box. Each page knows about the
// string to be displayed. For simplicity, we derive a class
// from CPropertyPage called CMyPropertyPage. CMyPropertyPage
// has a pure virtual member function called GetPageSelections().
// All pages in the property sheet must be derived from
// CMyPropertyPage so we loop through each page to get the
// formatted string by calling the GetPageSelections() function.
for (int i = 0; i < count; i++)
{
CMyPropertyPage* page = (CMyPropertyPage*) sheet->GetPage(i);
CString str;
page->GetPageSelections(str);
report += "\n" + str;
}
AfxMessageBox(report);
return CPropertyPage::OnWizardFinish();
}
// An example of implementing the GetPageSelections() for CStylePage.
// CStylePage is a CMyProperty-derived class which in turn is a
// CPropertyPage-derived class.
void CStylePage::GetPageSelections(CString &S)
{
CString shapename;
switch (m_Selection)
{
case IDC_RECTANGLE:
shapename = "Rectangle";
break;
case IDC_ROUND_RECTANGLE:
shapename = "Round Rectangle";
break;
case IDC_ELLIPSE:
shapename = "Ellipse";
break;
}
S.Format("Number of %s to be created = %d", shapename, m_NumObjects);
}
// An example of implementing the GetPageSelections() for CColorPage.
// CColorPage is a CMyProperty-derived class which in turn is a
// CPropertyPage-derived class.
void CColorPage::GetPageSelections(CString &S)
{
S = "Color selected is ";
switch (m_Color)
{
case RGB(0, 0, 0):
S += "Black";
break;
case RGB(255, 0, 0):
S += "Red";
break;
case RGB(0, 255, 0):
S += "Green";
break;
case RGB(0, 0, 255):
S += "Blue";
break;
}
}
CPropertyPage Overview | Class Members | Hierarchy Chart
See Also CPropertySheet::SetWizardMode