CWinApp and the MFC Application Wizard

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CWinApp and the MFC Application Wizard.

When it creates a skeleton application, the MFC Application Wizard declares an application class derived from CWinApp. The MFC Application Wizard also generates an implementation file that contains the following items:

  • A message map for the application class.

  • An empty class constructor.

  • A variable that declares the one and only object of the class.

  • A standard implementation of your InitInstance member function.

The application class is placed in the project header and main source files. The names of the class and files created are based on the project name you supply in the MFC Application Wizard. The easiest way to view the code for these classes is through Class View.

The standard implementations and message map supplied are adequate for many purposes, but you can modify them as needed. The most interesting of these implementations is the InitInstance member function. Typically, you will add code to the skeletal implementation of InitInstance.

See Also

CWinApp: The Application Class
Overridable CWinApp Member Functions
Special CWinApp Services