Visual C++ and MFC Fundamentals Chapter 12: Dialog-Based Windows
Practical Learning: Creating a Wizard
- Open Windows Explorer or My Computer and display the contents of the parent
folder that holds the previous exercise - In the right frame, right-click Geometry and click Copy
- Right-click an unoccupied area in the same right frame and click Paste
- Rename Copy of Geometry to WizardPages
- Open the WizardPages project or solution
- Access the CGeometry::InitInstance() event and change it as follows:
BOOL CGeometryApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CGeomeSheet GeoSheet("Geometric Calculations");
CQuadrilateral Quad;
CCircular Circ;
CGeome3D G3D;
GeoSheet.AddPage(&Quad);
GeoSheet.AddPage(&Circ);
GeoSheet.AddPage(&G3D);
m_pMainWnd = &GeoSheet;
GeoSheet.SetWizardMode();
int nResponse = GeoSheet.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
- Test the application