Before you move any of your code anywhere, use AppWizard to create a new MFC skeleton application. The files and classes that AppWizard produces are described in The MFC Files. Using those files and classes is described in Working with an Application Framework.
Tip Running AppWizard is described in the Visual C++ User's Guide for Visual C++ 2.0 and in the Visual Workbench User's Guide for earlier versions. See the documentation for your C++ development environment.
For SHOWDIB, create a new MFC project. Specify the name SHOWD for the project and its directory. In a later step you'll copy your C-language files into this project directory. As you work through AppWizard, select the following options:
Also, deselect the following options, which you don't need for this example:
Otherwise, accept all of the default options. You won't need any of the database, OLE, or other options for SHOWDIB.
Tip For your first migration, don't go overboard with MFC options. Add only the features you're willing to support in the long run. Keeping the skeleton application simple will make the migration process simpler.
Later in the process, you can remove the parts of your code that MFC implements for you. For example, if your application is MDI, you can scrap your MDI code, because MFC does MDI for you. Keep in mind that it's often (but not always) difficult to add an AppWizard feature after the fact. Adding AppWizard features later is discussed in Chapter 15 of Introducing Visual C++ (Visual C++ 2.0) or Chapter 10 of the Class Library User's Guide (earlier versions).
AppWizard lets you name your classes and the files they are in. Table 1 lists the names used in this migration guide to describe the classes and files in the MFC version of SHOWDIB. If you practice migrating SHOWDIB yourself, it will help if you use the same names. (You can avoid a name clash with one of SHOWDIB's files by not using "showdib" as your project name.)
Table 1 File and Class Names Used for SHOWDIB in This Migration Guide
Class Name | Filenames | Comment |
CShowDibApp | SHOWD.H/.CPP | Application class |
CShowDibView | SHOWDVW.H/.CPP | View class |
CShowDibDoc | SHOWDDOC.H/.CPP | Document class |
CMainFrame | MAINFRM.H/.CPP | Frame window class |
SHOWDIB.H/.C | Main original code file 1 | |
1 Later you will move SHOWDIB's original .C files into the project, but nearly all of the code you'll migrate is in just two files: SHOWDIB.H and SHOWDIB.C. |
In Visual C++ 2.0, AppWizard lets you change class and filenames at the end of the AppWizard process. In earlier versions, use the Classes button in AppWizard. In either case, select the class and fill in the edit boxes for class and filenames.