The AppWizard tool generates the code for a functioning MFC library application. This working application simply brings up an empty window with a menu attached. Later you'll add code that draws inside the window. Follow these steps to build the application:
Make sure that MFC AppWizard (exe) is highlighted, and then type C:\vcpp32\ in the Location edit box. Type ex03a as shown in the Project Name edit box, and then click the OK button. Now you will step through a sequence of AppWizard screens, the first of which is shown here.
Be sure to select the Single Document option. Accept the defaults in the next four screens. The last screen should look like the following illustration.
Notice that the class names and source-file names have been generated based on the project name EX03A. You could make changes to these names at this point if you wanted to. Click the Finish button. Just before AppWizard generates your code, it displays the New Project Information dialog box, shown here.
When you click the OK button, AppWizard begins to create your application's subdirectory (ex03a under \vcpp32) and a series of files in that subdirectory. When AppWizard is finished, look in the application's subdirectory. The following files are of interest (for now).
File | Description |
ex03a.dsp | A project file that allows Visual C++ to build your application |
ex03a.dsw | A workspace file that contains a single entry for ex03a.dsp |
ex03a.rc | An ASCII resource script file |
ex03aView.cpp | A view class implementation file that contains CEx03aView class member functions |
ex03aView.h | A view class header file that contains the CEx03aView class declaration |
ex03a.opt | A binary file that tells Visual C++ which files are open for this project and how the windows are arranged (This file is not created until you save the project.) |
ReadMe.txt | A text file that explains the purpose of the generated files |
resource.h | A header file that contains #define constant definitions |
Open the ex03aView.cpp and ex03aView.h files and look at the source code. Together these files define the CEx03aView class, which is central to the application. An object of class CEx03aView corresponds to the application's view window, where all the "action" takes place.
If the build is successful, an executable program named ex03a.exe is created in a new Debug subdirectory underneath \vcpp32\ex03a. The OBJ files and other intermediate files are also stored in Debug. Compare the file structure on disk with the structure in the Workspace window's FileView page shown here.
The FileView page contains a logical view of your project. The header files show up under Header Files, even though they are in the same subdirectory as the CPP files. The resource files are stored in the \res subdirectory.
When the Browse window appears, choose Base Classes And Members and then type CEx03aView. After you expand the hierarchy, you should see output similar to this.
Compare the browser output to ClassView in the Workspace window.
ClassView doesn't show the class hierarchy, but it also doesn't involve the extra overhead of the browser. If ClassView is sufficient for you, don't bother building the browser database.