Chapter 12: Dialog-Based Windows Visual C++ and MFC Fundamentals
c. You will receive a message box asking you whether you want to save the script.
Click Yes
d. Locate the ExoDialog1 folder that was used to create the current project.
Display it in the Save In combo box.
Change the name in the File Name with ExoDialog1
e. Click Save
- To add the resource to your application, on the main menu, click Project -> Add To
Project -> Files... - Click ExoDialog1.rc and click OK
- To verify that the dialog box has been added, in the Workspace, click the
ResourceView tab and expand the ExoDialog1 Resources node. Then expand the
Dialog folder and double-click IDD_EXERCISE_DLG - If you are using MSVC 7, on the Standard toolbar, the Save All. Then
12.1.9..Creating a Class for the Dialog.........................................................
After creating the resource for the dialog box, you must create a class that will be used to
handle its assignment. To do this, you must derive a class from CDialog. In the header
file of the dialog’s class, define an enumerator whose only member is called IDD and
initialize it with the identifier of the dialog box. Because the identifier is listed in the
resource header file, you must include this resource header in the file in which you are
using the dialog’s identifier.
Practical Learning: Create the Dialog’s Class
- To create a class for the dialog box, open the Exercise.cpp created earlier and add the
following:
#include <afxwin.h>
#include <afxdlgs.h>
#include "resource.h"
class CExerciseApp : public CWinApp
{
public: