Wizard Property Sheets and Pages

I made these two classes to add an often used feature to the property sheets/pages provided by the MFC. The new classes allow you, to easily skip certain pages when viewing the tabbed dialog. This is very usefull for installation or assistent wizards.

You can now also access the the property sheet from every page using the m_pPropSheet protected member.

Using the Classes

These classes work only in wizard mode, which is set by default, so there's no need to set it by hand. There's no way to use the extra functionlity of these classes while not in Wizard mode.

To use the CWizPropertyPage, just implement your pages as decendents of CPropertyPage and then use the replace functionality of the editor to exchange every CPropertyPage with CWizPropertyPage.

To skip pages, you can either disable these page directly, or tell the WizPropertySheet to disable a whole range:

	// I'm assuming that CPage1 - CPage3 are derived from
	// CWizPropertyPage
	CPage1 page1;
	CPage2 page2;
	CPage3 page3;
	CWizPropertySheet sheet;
	// Disable page 1 and 2
	// Enable them via the sheet
	sheet.EnablePages(TRUE,1,2);	// NOTE: zero based index


This class is derived from CPropertySheet and does add a single method:
    void EnablePages(BOOL bEnable, int nStart, int nEnd = -1);
  • If bEnable is TRUE the pages get enabled, if FALSE they will be disabled
  • nStart specifies the first page to enable or disable.
  • nEnd specifies the last page to enable/ disable. If omitted, only the page with the index nStart will be changed.
All constructors are changed to set wizard mode, Add() sets a protected varible within CWizPropertyPage, so the pages know to which sheet they belong.


This class is derived from CPropertyPage, and adds these methods:
	BOOL Enable(BOOL bEnable=TRUE);
	BOOL IsEnabled(void);
	virtual LRESULT GetNextPage(BOOL forward = TRUE); // protected
and these data members:
    BOOL m_bEnabled; // protected CWizPropertySheet *m_pPropSheet;// protected
Use Enable() to enable a page, and Enable(FALSE) to disable a page.
IsEnabled() returns the TRUE if the pages is enabled, else FALSE is returned.

m_pPropSheet allows you to access the sheet the page got added to.

In closing

Guess that's it. If you've questions, critique or if you want to thank me :), feel free to mail me.

Download source


  • How do i transfer data between one wizard page and the other?

    Posted by Legacy on 02/12/2004 12:00am

    Originally posted by: Farhan

    I want to transfer data entered by the user on my first wizard page and make it visible on the second wizard page in my wizard sheet? How do i achieve it?

  • Header bitmaps

    Posted by Legacy on 03/31/2003 12:00am

    Originally posted by: Sabotto Massimo

    How can i change the header bitmap from one page to another?
    I already tryed to change the m_psh.hbmHeader parameter value, but nothing changed!

    Any idea?

    thank you

  • How do i change the title of the property page at run time?

    Posted by Legacy on 02/06/2003 12:00am

    Originally posted by: Hema Leon

    I have 3 property pages. Title on the property page 3 is based on the selection of page 2. So how do i change the title of the property page 3?

  • Modification to auto-set the wizard buttons

    Posted by Legacy on 01/17/2002 12:00am

    Originally posted by: Ian

    I've always wondered why it is the responsibility of the 
    Property Page to set the wizard buttons, since the Property
    Sheet should know where in the sequence of pages you are.

    Unless you're doing something funky with jumping randomly
    about the page array, I suppose.

    Anyway, I found that adding this code to the OnSetActive
    method on CWizPropertyPage means your pages can forget about it -- the buttons will be set automagically.

    BOOL CWizPropertyPage::OnSetActive()
    int act = m_pPropSheet->GetActiveIndex();
    int count= m_pPropSheet->GetPageCount();

    DWORD dwButtons = 0;
    if (act == count - 1) dwButtons |= PSWIZB_FINISH;
    if (act < count - 1) dwButtons |= PSWIZB_NEXT;
    if (act > 0) dwButtons |= PSWIZB_BACK;

    m_pPropSheet->SetWizardButtons( dwButtons );

    return CPropertyPage::OnSetActive();

  • GetNextPage not moving me to the correct page!

    Posted by Legacy on 07/29/1999 12:00am

    Originally posted by: Jim Carbone

    //This code is found in the CWizPropertyPage, GetNextPage //method.

    //This part of the logic finds the next enabled page to //move to. My case needs to move from page 2 to page 5.
    while (!found && act < count && act >=0)
    pPage = (CWizPropertyPage*) m_pPropSheet->GetPage(act);
    if (pPage->IsEnabled())
    found = TRUE;
    act += (forward ? 1: -1);


    //Page 5 is found correctly (5 = act), but the next page
    //that is displayed is page 1!
    if (found)
    return (LRESULT) pPage->m_lpszTemplateName;
    return -1; // Nowhere to go :)

    Please help me determine why the incorrect page is displaying. This method worked great previously, then I started a new project and it stopped working!

    I will send my source if it would help.
    Thanks for any assistance,

    Jim Carbone

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: May 11, 2015 @ 1:00 p.m. ET / 10:00 a.m. PT One of the languages that have always been supported with the Intel® RealSense™ SDK (Software Developer Kit) is JavaScript, specifically so that web-enabled apps could be created. Come hear from Intel Expert Bob Duffy as he reviews his own little "space shooting" game where the orientation of your face controls the aiming reticle to help teach developers how to write apps and games in JavaScript that can use facial and gesture …

  • There has been growing buzz about DevOps. DevOps is a methodology that unites the often separate functions of software development (Dev) and production and operations (Ops) into a single, integrated, and continuous process. DevOps is about breaking down the barriers between Dev and Ops. It leverages people, processes, and technology to stimulate collaboration and innovation across the entire software development and release process. Dev and Ops should always be part of an integrated process, but that's not …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date