Click here to Skip to main content
11,929,481 members (52,616 online)
Click here to Skip to main content
Add your own
alternative version


42 bookmarked

Resizeable Wizard97 style Wizards

, 28 Jul 2001 CPOL
Rate this:
Please Sign up or sign in to vote.
Property sheet and page classes for resizeable Wizard97 style Wizards

Resizable wizard image

<!-- Add the rest of your HTML here -->


A year or so ago I implemented a wizard for the calibration of positions of arrays of acoustic beacons on the seabed, as part of our Pharos acoustic positioning application.

After doing a little research, I proposed that we use the (then relatively new) Wizard97 style to implement it, to give it more visual impact. To this end, I implemented MFC classes for a wizard sheet (CWizard) and page (CWizardPage). Although most of the pages were conventional, one of them contained a Chart view (with an associated document) within a frame window, complete with two toolbars:

Resizable wizard image

This page introduced a problem. To make it useable it really needed to be bigger - or, even better, resizeable. Unfortunately, at the time we had higher priorities so resizing stayed firmly on the "to do" list.

The breakthrough came with the publication of Herbert Menke's CResizeCtrl on Code Project, which we started using to support resizeable dialogs and property pages elsewhere within the project. In due course, the inevitable happened, and we implemented another Wizard.

Unfortunately, when we integrated CResizeCtrl into the new wizard, the Wizard97 style appeared to be incompatible with resizing - the watermark and header bitmaps failed to paint correctly. As a result, the new wizard was implemented with the Wizard97 features disabled (we reasoned that we could always paint them ourselves if we couldn't find a solution later).

I've now finally got around to doing just that. Using code from Joerg Koenig's CBitmapDialog class, CWizard now paints the header bitmaps, and CWizardPage the watermarks. I had to make some minor changes to CResizeCtrl to accommodate wizard pages with header bitmaps, but other than that it worked pretty much first time.

To demonstrate these classes I've incorporated them into the Microsoft Wizard97 sample (renamed as CNGWizard and CNGWizardPage respectively).

The demo project compiles quite happily at warning Level 4; ANSI and Unicode builds are supported.


Before implementing your own Wizard97 classes, it's worth reading the Wizard97 Specification in the Visual C++ Help (its also available on the MSDN website), which contains useful guidelines for implementing wizards using the Wizard97 style.

Implementing a wizard using these classes is pretty straightforward:

  1. Derive your wizard sheet class from CNGWizard, and your page classes from CNGWizardPage

  2. Add an OnInitDialog() override to each page and add the page's controls to the resizer (see Herbert Menke's CResizeCtrl article for full details on how to do this)

  3. Set CNGWizard::m_bResizeable in the constructor of your wizard sheet class if you want your wizard to be resizeable

  4. Set CNGWizard::m_bShowFinishAlways in the constructor of your wizard sheet class if you want the Next and Finish buttons in the wizard to both be visible at all times (this can be useful in some wizards)

  5. Initialise your wizard sheet by specifying the watermark and header bitmaps, together with their display styles (centred, tiled or stretched for the watermark, and tiled or stretched for the header)

  6. Create your pages and add them to the wizard. CNGWizard will configure the pages for you as they are added.

    Note that each page will be (briefly) activated as it is added to allow the resizer to initialise properly. A consequence of this is that OnInitDialog() and OnSetActive() overrides in your pages will be called earlier than they may expect. To prevent this causing problems, CNGWizardPage has an IsInitialising() method which derived classes can use to determine whether this is the case:

    BOOL CInterior1::OnInitDialog()
    	if (IsResizeable())
    		// Add: id, left, top, width, height
    		m_Resizer.Add( IDC_LIST1, 0, 0, 100, 100 );
    		m_Resizer.Add( IDC_STATIC_DESC, 100, 0, 0, 100 );
    		m_Resizer.Add( IDC_BUTTON1,	100, 100, 0, 0 );
    	return TRUE;
    BOOL CInterior1::OnSetActive()
    	if (!IsInitialising())
    		EnableWizardButtons(PSWIZB_BACK | PSWIZB_NEXT, TRUE);
    	return CInterior1_BASE::OnSetActive();

System Requirements and Limitations

  1. Because these classes are based upon the CPropertySheetEx and CPropertyPageEx classes introduced with Visual C++ 6.0, I'm afraid this code will not work with Visual C++ 5.0.

  2. On older systems (pre-WinMe/2000) the use of Wizard97 may require an upgrade to the common controls library (comctl32.dll), since version 5.80 or later is required to use Wizard97 controls. If your system requires this update, you can download an installer (50comupd.exe) for the update from the Microsoft web site at

  3. According to the Microsoft documentation on Wizard97, Wizard97 controls will not work correctly on Windows 95 systems. However, when I ran this sample on a Win95 machine the only problem I could see was that static controls on pages which had watermarks didn't display correctly (presumably because transparency doesn't work for static controls on Win95). Apart from that minor problem, the wizard worked just fine and was perfectly legible.

  4. In order to correctly repaint the watermark and header bitmaps when the wizard is resized the windows must be created with theCS_HREDRAW and CS_VREDRAW window class styles. Although this should be done by registering a custom window class, CNGWizard::OnInitDialog() currently just modifies the global style using the Platform SDK function SetClassLong().


...a bit of a plug: if you want to see an example of these classes in action, check out my Resource ID Organiser Add-In for Visual C++ which uses these classes to implement a Wizard for renumbering resource symbols.

If you have any comments, suggestions, bug reports etc. please feel free to email me at


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Anna-Jayne Metcalfe
Founder Riverblade Limited
United Kingdom United Kingdom
I haven't always written software for a living. When I graduated from Surrey University in 1989, it was with an Electronic Engineering degree, but unfortunately that never really gave me the opportunity to do anything particularly interesting (with the possible exception of designing Darth Vader's Codpiece * for the UK Army in 1990).
    * Also known as the Standard Army Bootswitch. But that's another story...
Since the opportunity arose to lead a software team developing C++ software for Avionic Test Systems in 1996, I've not looked back. More recently I've been involved in the development of subsea acoustic navigation systems, digital TV broadcast systems, port security/tracking systems, and most recently software development tools with my own company, Riverblade Ltd.

One of my personal specialities is IDE plug-in development. ResOrg was my first attempt at a plug-in, but my day to day work is with Visual Lint, an interactive code analysis tool environment with works within the Visual Studio and Eclipse IDEs or on build servers.

I love lots of things, but particularly music, photography and anything connected with history or engineering. I despise ignorant, intolerant and obstructive people - and it shows...I can be a bolshy cow if you wind me up the wrong way...Laugh | :laugh:

I'm currently based 15 minutes walk from the beach in Bournemouth on the south coast of England. Since I moved here I've grown to love the place - even if it is full of grockles in Summer!

You may also be interested in...

Comments and Discussions

GeneralPlease Help Me! Pin
Redhouane_KM11-Jun-06 5:28
memberRedhouane_KM11-Jun-06 5:28 
GeneralRe: Please Help Me! Pin
Chris Losinger11-Aug-06 5:44
memberChris Losinger11-Aug-06 5:44 
Generaldoes not run on windows 98 Pin
emmi4-Apr-06 22:47
memberemmi4-Apr-06 22:47 
GeneralActually, it does - if you have the right version of comctl32.dll Pin
Anna-Jayne Metcalfe5-Apr-06 12:29
memberAnna-Jayne Metcalfe5-Apr-06 12:29 
GeneralHeader image Pin
Geert van Horrik15-Apr-05 4:12
memberGeert van Horrik15-Apr-05 4:12 
GeneralRe: Header image Pin
Anna-Jayne Metcalfe23-Nov-05 6:23
memberAnna-Jayne Metcalfe23-Nov-05 6:23 
GeneralThanks.. Pin
mailMonty1-Apr-04 20:19
membermailMonty1-Apr-04 20:19 
...Just what i was looking for.
Thanks again for sharing ur code Smile | :)

C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
GeneralRe: Thanks.. Pin
Anna-Jayne Metcalfe6-Apr-04 12:11
memberAnna-Jayne Metcalfe6-Apr-04 12:11 
GeneralOnWizardBack(), OnWizardNext(), etc. Pin
Blake Miller16-Oct-03 12:12
memberBlake Miller16-Oct-03 12:12 
GeneralRe: OnWizardBack(), OnWizardNext(), etc. Pin
Anna-Jayne Metcalfe20-Oct-03 12:50
memberAnna-Jayne Metcalfe20-Oct-03 12:50 
GeneralRe: OnWizardBack(), OnWizardNext(), etc. Pin
Blake Miller21-Oct-03 9:45
memberBlake Miller21-Oct-03 9:45 
GeneralRe: OnWizardBack(), OnWizardNext(), etc. Pin
Anna-Jayne Metcalfe21-Oct-03 10:04
memberAnna-Jayne Metcalfe21-Oct-03 10:04 
QuestionHow to add a Minimum and Maximum button into Property sheet?? Pin
LesleyLiang10-Feb-03 17:20
memberLesleyLiang10-Feb-03 17:20 
QuestionHow do i Set to Read Only MultiLine Edit Box? Pin
rajesh_s764-Jul-02 18:09
memberrajesh_s764-Jul-02 18:09 
QuestionHow about a "SetSideBanner" Pin
Anonymous3-Jul-02 2:49
memberAnonymous3-Jul-02 2:49 
AnswerRe: How about a "SetSideBanner" Pin
Andy Metcalfe3-Jul-02 7:51
memberAndy Metcalfe3-Jul-02 7:51 
QuestionHow do i add New Button? Pin
rajesh_s7623-Jun-02 23:41
memberrajesh_s7623-Jun-02 23:41 
GeneralHeader and Sub title problem !!!!!!!!!! Pin
rajesh_s7612-Jun-02 18:02
memberrajesh_s7612-Jun-02 18:02 
GeneralRe: Header and Sub title problem !!!!!!!!!! Pin
Andy Metcalfe18-Jun-02 11:13
memberAndy Metcalfe18-Jun-02 11:13 
QuestionHeaderTitle and subtitle How? Pin
Rajesh_s7622-Apr-02 1:28
memberRajesh_s7622-Apr-02 1:28 
AnswerRe: HeaderTitle and subtitle How? Pin
Andy Metcalfe24-Apr-02 13:23
memberAndy Metcalfe24-Apr-02 13:23 
GeneralRe: HeaderTitle and subtitle How? Pin
rajesh_s7612-Jun-02 18:00
memberrajesh_s7612-Jun-02 18:00 
GeneralWindows 95 Pin
Andrew Phillips4-Mar-02 17:10
memberAndrew Phillips4-Mar-02 17:10 
GeneralRe: Windows 95 Pin
Andy Metcalfe4-Mar-02 21:17
memberAndy Metcalfe4-Mar-02 21:17 
GeneralRe: Windows 95 Pin
Rajesh_s7623-Apr-02 19:23
memberRajesh_s7623-Apr-02 19:23 
GeneralRe: Windows 95 Pin
Rajesh_s7623-Apr-02 19:21
memberRajesh_s7623-Apr-02 19:21 
GeneralRe: Windows 95 Pin
Andy Metcalfe24-Apr-02 13:44
memberAndy Metcalfe24-Apr-02 13:44 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151126.1 | Last Updated 29 Jul 2001
Article Copyright 2001 by Anna-Jayne Metcalfe
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid