MFC: Using the MFC Source Files

OverviewHow Do ITutorial

The Microsoft Foundation Class Library (MFC) supplies full source code. Header files (.H) are in the MFC\Include directory; implementation files (.Cpp) are in the MFC\Src directory.

Note   The MFC\Src directory contains a makefile you can use with NMake to build MFC library versions, including a browse version. A browse version of MFC is useful for tracing through the calling structure of MFC itself. The file Readme.Txt in that directory explains how to use this makefile.

This family of articles explains the conventions that MFC uses to comment the various parts of each class, what these comments mean, and what you should expect to find in each section. ClassWizard and AppWizard use similar conventions for the classes they create for you, and you will probably find these conventions useful for your own code.

You might be familiar with the public, protected, and private C++ keywords. When looking at the MFC header files, you'll find that each class may have several of each of these. For example, public member variables and functions might be under more than one public keyword. This is because MFC separates member variables and functions based on their use, not by the type of access allowed. MFC uses private sparingly — even items considered implementation details are generally protected and many times are public. Although access to the implementation details is discouraged, MFC leaves the decision to you.

In both the MFC source files and the files that AppWizard creates, you will find comments like these within class declarations (usually in this order):

// Constructors
// Attributes
// Operations
// Overridables
// Implementation

Topics covered in this family of articles include: