This documentation is archived and is not being maintained.


Enables or disables the Back, Next, or Finish button in a wizard property sheet.

void SetWizardButtons(
   DWORD dwFlags 



A set of flags that customize the function and appearance of the wizard buttons. This parameter can be a combination of the following values:

  • PSWIZB_BACK   Back button

  • PSWIZB_NEXT   Next button

  • PSWIZB_FINISH   Finish button

  • PSWIZB_DISABLEDFINISH   Disabled Finish button

Call SetWizardButtons only after the dialog is open; you can't call SetWizardButtons before you call DoModal. Typically, you should call SetWizardButtons from CPropertyPage::OnSetActive.

If you want to change the text on the Finish button or hide the Next and Back buttons once the user has completed the wizard, call SetFinishText. Note that the same button is shared for Finish and Next. You can display a Finish or a Next button at one time, but not both.

// A CPropertySheet has three wizard property pages: CStylePage, 
// CColorPage, and CShapePage.  The code fragment below shows how to 
// enable and disable the Back and Next buttons on the wizard 
// property page.

// CStylePage is the first wizard property page.  Disable the Back 
// button but enable the Next button.
BOOL CStylePage::OnSetActive() 
   CPropertySheet* psheet = (CPropertySheet*) GetParent();   
   return CPropertyPage::OnSetActive();

// CColorPage is the second wizard property page. Enable both the 
// Back button and the Next button.
BOOL CColorPage::OnSetActive() 
   CPropertySheet* psheet = (CPropertySheet*) GetParent();   
   psheet->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);

   return CPropertyPage::OnSetActive();

// CShapePage is the third wizard property page. Enable the Back 
// button and change the Next button to Finish. If dwFlags is equal 
// button is enabled but the Next button is disabled.
BOOL CShapePage::OnSetActive() 
   CPropertySheet* psheet = (CPropertySheet*) GetParent();   
   psheet->SetWizardButtons(PSWIZB_BACK | PSWIZB_FINISH);

   return CPropertyPage::OnSetActive();