Wizard Property Sheets and Pages | CodeGuru

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 […]

Written By
CodeGuru Staff
CodeGuru Staff
Aug 6, 1998
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More


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;

	sheet.Add(page1);
	sheet.Add(page2);
	sheet.Add(page3);

	// Disable page 1 and 2
	page1.Enable(FALSE);
	page2.Enable(FALSE);

	// Enable them via the sheet
	sheet.EnablePages(TRUE,1,2);	// NOTE: zero based index

CWizPropertySheet


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.


CWizPropertyPage

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.


Advertisement

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

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.