CPropertyPage::OnWizardFinish
當使用者按一下精靈時,結束按鈕此成員函式由架構呼叫。
virtual BOOL OnWizardFinish( );
傳回值
如果不是零,終結屬性工作表,當精靈結束;則為零。
備註
當使用者按一下精靈中的 完成 按鈕,架構會呼叫這個函式,當 OnWizardFinish 傳回 是 (非零的值),則屬性工作表上已終結 (,但不會實際終結)。 呼叫終結屬性工作表的 DestroyWindow 。 不要呼叫 OnWizardFinish的 DestroyWindow ;這樣做會造成堆積損毀或其他錯誤。
您可以覆寫這個成員函式指定使用者必須採取一些動作,當結束按鈕時。 覆寫這個函式,傳回 否 防止屬性工作表終結時。
如需通知訊息的詳細資訊傳送,當使用者在精靈屬性工作表上完成按鈕,查看 Windows SDK的 PSN_WIZFINISH 。
如需如何執行的精靈類型的屬性工作表的詳細資訊,請參閱 CPropertySheet::SetWizardMode。
範例
// Inform users regarding the selections they have made by
// navigating the pages in propertysheet.
BOOL CShapePage::OnWizardFinish()
{
CString report = _T("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 += _T("\n") + str;
}
AfxMessageBox(report);
return CPropertyPage::OnWizardFinish();
}
// An example of implementing the GetPageSelections() for CStylePage.
// CStylePage is a CMyPropertyPage-derived class, which in turn is a
// CPropertyPage-derived class.
void CStylePage::GetPageSelections(CString &str)
{
str.Format(_T("Number of objects to be created = %d"), m_NumObjects);
}
// An example of implementing the GetPageSelections() for CColorPage.
// CColorPage is a CMyPropertyPage-derived class, which in turn is a
// CPropertyPage-derived class.
void CColorPage::GetPageSelections(CString &str)
{
str = _T("Color selected is ");
switch (m_Color)
{
case RGB(0, 0, 0):
str += _T("Black");
break;
case RGB(255, 0, 0):
str += _T("Red");
break;
case RGB(0, 255, 0):
str += _T("Green");
break;
case RGB(0, 0, 255):
str += _T("Blue");
break;
default:
str += _T("Custom");
break;
}
}
// An example of implementing the GetPageSelections() for CShapePage.
// CShapePage is a CMyPropertyPage-derived class, which in turn is a
// CPropertyPage-derived class.
void CShapePage::GetPageSelections(CString &str)
{
CString shapename;
switch (m_Selection)
{
case IDC_RECTANGLE:
shapename = _T("Rectangle");
break;
case IDC_ROUND_RECTANGLE:
shapename = _T("Round Rectangle");
break;
case IDC_ELLIPSE:
shapename = _T("Ellipse");
break;
}
str.Format(_T("Shape to be created is %s"), shapename);
}
需求
Header: afxdlgs.h