Add Code to the MFC EXE Starter Files

OverviewHow Do IDetails

After using AppWizard to create an MFC program, you get a working starter application with whatever functionality you asked for when completing the steps in AppWizard.

Your compiled program now implements the basic features of a Windows executable (.EXE) application. Your final step is to supply the application-specific source code and connect the components by defining what messages and commands the starter files should respond to.

The easiest way to add functions and navigate to them in your starter files is either by using ClassWizard or WizardBar. You can also insert components from the that will add code to your project.

If you chose the option to generate source file comments, the MFC AppWizard creates a file called ReadMe.txt in your project directory that contains a complete listing and description of all the files that it has created. The newly created starter files will display comments in green when viewed in the project workspace. The comments indicate where to add your source code, and help define the class behaviors for your specific application.

Note   In the source code, look for the comment: // TODO: add . . . code here, which explains where to add code; the comments also explain where not to edit specific blocks of code.

Example of where to add your code

// CApp3xeDoc construction/destruction
CApp3xeDoc::CApp3xeDoc()
{
   // TODO: add one-time construction code here
}
CApp3xeDoc::~CApp3xeDoc()
{
}

What do you want to know more about?