Click here to Skip to main content
12,829,103 members (40,122 online)
Click here to Skip to main content
Add your own
alternative version


30 bookmarked
Posted 9 Apr 2000

Simple wizard property sheet class

, 14 Apr 2000
Rate this:
Please Sign up or sign in to vote.
A simply class to turn CPropertySheet into wizard mode without needing to alert the property pages within
<!-- Link to source file download -->
  • Download source files - 2 Kb
  • <!-- Add the rest of your HTML here -->


    Windows allows a simple transition of your property sheet into wizard mode. However, this transition requires the property pages within the sheet to know about this. They should call SetWizardButtons() with the correct parameters on becoming active - which of course breaks encapsulation. The page needs to know it's part of wizard-style property sheet, and it needs to know its position within the sheet.

    My CWizardPropertySheet class solves the problem for simple wizards by having the CPropertySheet-derived class handle the appropriate SetWizardButtons() calls by itself.

    The CWizardPropertySheet class

    The CWizardPropertySheet is a drop-in replacement for CPropertySheet. It works both in wizard and "normal" modes. (The application must call SetWizardMode() to activate wizard mode, just as it would with a normal CPropertyPage.)

    To use it, simply #include "WizardPropertySheet.h" and use CWizardPropertySheet wherever you would use CPropertySheet. (Alternatively, you may import the class by ClassWizard.)

    What does it do?

    The CWizardPropertySheet shows the property pages added by AddPage() call in order they have been added. It disables the Back button on the first page, and it changes Next to Finish on the last page.

    How does it accomplish that?

    The message map of the class contains handlers:

    The ID_WIZBACK and ID_WIZNEXT constants are defined in afxres.h. The handlers do the proper SetWizardButtons() call and then call Default(); to allow page change to proceed.

    Don't forget!

    Don't forget to call SetWizardMode() before DoModal() to put the property sheet into wizard more.


    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    About the Author

    Petr Novotny
    Czech Republic Czech Republic
    No Biography provided

    You may also be interested in...

    Comments and Discussions

    QuestionCCheckListBox in CPropertyPage Pin
    Member 936463717-Sep-12 17:54
    memberMember 936463717-Sep-12 17:54 
    QuestionIn CPropertySheet how to set both Wizard mode & Normal mode for an application? Pin
    shan_chandru20-Apr-09 4:47
    membershan_chandru20-Apr-09 4:47 
    Generaluseless example Pin
    bfawad14-Aug-07 8:12
    memberbfawad14-Aug-07 8:12 
    Generaland a rude comment Pin
    K(arl)6-Sep-07 22:02
    memberK(arl)6-Sep-07 22:02 
    Generalowner drawn wizzard buttons Pin
    avishap1-Jun-05 6:55
    memberavishap1-Jun-05 6:55 
    Questioncan i make my dialog resource class inherit from this? Pin
    spoongirl8-May-02 4:15
    memberspoongirl8-May-02 4:15 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Terms of Use | Mobile
    Web01 | 2.8.170326.1 | Last Updated 15 Apr 2000
    Article Copyright 2000 by Petr Novotny
    Everything else Copyright © CodeProject, 1999-2017
    Layout: fixed | fluid