MFC Application Setup in Visual Studio

Aug 26, 2024

Setting Up an MFC Application in Visual Studio 2015

Introduction

  • Overview of setting up a Microsoft Foundation Classes (MFC) application.

Step 1: Creating a New Project

  • Open Visual Studio 2015.
  • Go to File > New Project.
  • Locate Visual C++.
    • If not installed, click on it to install.
    • Ensure MFC is included in the installation.

Step 2: Project Configuration

  • Select MFC Application and name your project.
  • Choose the directory where you want to save it and click OK.

Step 3: Application Type Selection

  • Choose between console and dialog-based applications.
  • For this setup, select Dialog-based application.
    • Multi-document applications allow viewing documents within, which is not desired here.
  • Default settings:
    • Uncheck Use HTML Dialog and Enhanced MFC Controls if not needed.
    • Change Security Development Lifecycle settings as required (optional).

Step 4: MFC DLL Settings

  • Change from Use MFC DLL to your desired setting.
  • Click Next.

Step 5: Window Features

  • Enable Minimize Box and Maximize Box:
    • These allow the application window to be minimized and maximized.
    • Leave other features as default.
  • Click Next.

Step 6: ActiveX Controls

  • ActiveX controls can be left enabled (optional).
  • Click Next.

Step 7: Class Generation

  • Notice two classes are created.
  • Click Finish to complete project setup.

Step 8: Initial Setup in the Application

  • After loading, you may see a grid setup (may not be present by default).
  • Delete any placeholder text (e.g., "To do: Place dialog controls here").
  • Save changes.

Step 9: Adjusting Grid and Ruler Settings

  • Go to Format > Guide Settings to change grid settings:
    • Option to toggle grid or set up rulers.

Step 10: Running the Application

  • Click Local Windows Debugger to run the application.
    • Confirm with Yes to build it.
  • Observe that the application appears and responds to buttons (e.g., OK and Cancel).

Conclusion

  • The application is successfully set up and runs as intended.
  • Thank you for watching!