Creating an MFC Application

An MFC application is an executable application for Windows that is based on the Microsoft Foundation Class (MFC) Library. MFC executables generally fall into five types: standard Windows applications, dialog boxes, forms-based applications, Explorer-style applications, and Web browser-style applications. For more information, see:

The MFC Application Wizard generates the appropriate classes and files for any of these types of applications, depending on the options you select in the wizard.

The easiest way to create an MFC application is to use the MFC Application Wizard (MFC App project in Visual Studio 2019). To create an MFC console application (a command-line program that uses MFC libraries but runs in the console window), use the Windows Desktop Wizard and choose the Console Application and MFC Headers options.

To create an MFC forms or dialog-based application

  1. From the main menu, choose File > New > Project.
  2. Enter "MFC" into the search box and then choose MFC App from the result list.
  3. Modify the defaults as needed, then press Create to open the MFC Application Wizard.
  4. Modify the configuration values as needed, then press Finish.

For more information, see Creating a Forms-Based MFC Application.

MFC Application Wizard

To create an MFC console application

An MFC console application is a command-line program that uses MFC libraries but runs in the console window.

  1. From the main menu, choose File > New > Project.
  2. Enter "Desktop" into the search box and then choose Windows Desktop Wizard from the result list.
  3. Modify the project name as needed, then press Next to open the Windows Desktop Wizard.
  4. Check the MFC Headers box and set other values as needed, then press Finish.

MFC Application Wizard

To create an MFC forms or dialog-based application

  1. From the main menu, choose File > New > Project.
  2. Under the Installed templates, choose Visual C++ > MFC/ATL. If you don't see these, use the Visual Studio Installer to add them.
  3. Choose MFC Application from the center pane.
  4. Modify the configuration values as needed, then press Finish.

For more information, see Creating a Forms-Based MFC Application.

MFC Application Wizard

To create an MFC console application

An MFC console application is a command-line program that uses MFC libraries but runs in the console window.

  1. From the main menu, choose File > New > Project.
  2. Under the Installed templates, choose Visual C++ > Windows Desktop.
  3. Choose Windows Desktop Wizard from the center pane.
  4. Modify the project name as needed, then press OK to open the Windows Desktop Wizard.
  5. Check the MFC Headers box and set other values as needed, then press Finish.

MFC Application Wizard

To create an MFC forms or dialog-based application

  1. From the main menu, choose File > New > Project.
  2. Under the Installed templates, choose Visual C++ > MFC.
  3. Choose MFC Application from the center pane.
  4. Click Next to start the MFC Application Wizard.

For more information, see Creating a Forms-Based MFC Application.

MFC Application Wizard

To create an MFC console application

An MFC console application is a command-line program that uses MFC libraries but runs in the console window.

  1. From the main menu, choose File > New > Project.
  2. Under the Installed templates, choose Visual C++ > Win32.
  3. Choose Win32 Console Application from the center pane.
  4. Modify the project name as needed, then press OK.
  5. On the second page of the wizard, check the Add common headers for MFC box and set other values as needed, then press Finish.

Once your project is created, you can view the files created in Solution Explorer. For more information about the files the wizard creates for your project, see the project-generated file ReadMe.txt. For more information about the file types, see File Types Created for Visual Studio C++ projects.

See also

Adding Functionality with Code Wizards
Property Pages