다음을 통해 공유


CPropertyPage::OnWizardFinish

마법사에서 마침 단추를 클릭할 때이 멤버 함수는 프레임 워크에서 호출 됩니다.

virtual BOOL OnWizardFinish( );

반환 값

마법사가 끝나면 속성 시트 파괴 되 면 0이 아닌. 그렇지 않으면 0입니다.

설명

사용자가 클릭할 때의 완료 단추 마법사 프레임 워크에서에서 호출이 함수가 고 때 OnWizardFinish 반환 TRUE (0이 아닌 값) 속성 시트 소멸 될 수 있습니다 (하지만 실제로 파괴 됩니다). 호출 DestroyWindow 속성 시트를 파괴 합니다. Do not call DestroyWindow from OnWizardFinish; 이렇게 하면 따라서 힙 손상 또는 다른 오류가 발생 합니다.

[마침] 단추를 누르면 사용자가 수행 해야 하는 일부 동작을 지정 하려면이 멤버 함수를 재정의할 수 있습니다. 이 함수를 재정의할 때 반환 거짓 속성 시트 파괴 되지 않도록 합니다.

마법사 속성 시트 마침 단추를 누를 때 보낼 알림 메시지에 대 한 자세한 내용은 PSN_WIZFINISH 에 있는 Windows SDK.

마법사 형식의 속성 시트를 만드는 방법에 대 한 자세한 내용은 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);
}

요구 사항

헤더: afxdlgs.h

참고 항목

참조

CPropertyPage 클래스

계층 구조 차트

CPropertySheet::SetWizardMode