Share via


CPropertyPage::OnWizardFinish

Esta función miembro llaman el marco cuando el usuario hace clic en el botón del final del asistente.

virtual BOOL OnWizardFinish( );

Valor devuelto

Distinto de cero si se destruye la hoja de propiedades cuando el asistente finaliza; si no cero.

Comentarios

Cuando un usuario hace clic en el botón de Finalizar en un asistente, el marco de trabajo llama a esta función; cuando OnWizardFinish devuelve TRUE (un valor distinto de cero), la hoja de propiedades puede ser destruido (pero no se destruye realmente).Llamada DestroyWindow destruir la hoja de propiedades.No llame a DestroyWindow de OnWizardFinish; al hacerlo así provocará el montón está dañado u otros errores.

Puede reemplazar esta función miembro para especificar una acción que el usuario debe realizar cuando se presiona el botón de final.Al reemplazar esta función, FALSO return para evitar que la hoja de propiedades sea destruida.

Para obtener más información sobre los mensajes de notificación enviados cuando el usuario presiona el botón de final en una hoja de propiedades del asistente, vea PSN_WIZFINISH en Windows SDK.

Para obtener más información sobre cómo hacer una hoja de propiedades de asistente-tipo, vea CPropertySheet:: SetWizardMode.

Ejemplo

// 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);
}

Requisitos

encabezado: afxdlgs.h

Vea también

Referencia

Clase de CPropertyPage

Gráfico de jerarquía

CPropertySheet::SetWizardMode