Chapter 12: Dialog-Based Windows Visual C++ and MFC Fundamentals
- Click Finish
- Test the application and return to MSVC
12.2.3..A Modal Dialog Box in an Application...........................................
Some applications require various dialog boxes to complete their functionality. When in
case, you may need to call one dialog box from another and display it as modal. Here is
an example:
The Paragraph dialog box of
WordPad is a modal dialog box:
when it is displaying, the user
cannot use any other part of
WordPad unless he or she
closes this object first
Since a dialog box is created using a class, the first thing you must do is to include the
header file of the CDialog object whose box you want to call.
To call one dialog box from another window, select the event (or message) from where
you would make the call. Declare a variable of the other class and use the
CDialog::DoModal() method to display the other object as a modal dialog box.
Calling a dialog box from the menu of a frame-based application is done the same way as
calling it from a dialog box