Microsoft Foundation Classes (MFC)

Definition of Microsoft Foundation Classes (MFC) in The Network Encyclopedia.

What is MFC (Microsoft Foundation Classes)?

A set of classes, global functions, global variables, and macros developed by Microsoft that provides a framework for developing applications for Microsoft Windows platforms.

How it works

The Microsoft Foundation Classes (MFC) are an object-oriented interface to the Windows application programming interface (API). MFC encapsulates much of the Windows API by providing classes that represent key Windows objects, such as windows, controls, dialog boxes, brushes, and fonts. Programmers can develop Windows-based applications by using a combination of C++ code and MFC instead of calling Windows API functions directly. Many MFC class member functions actually call the encapsulated Windows API functions. Note that you cannot call MFC class member functions directly - you have to instantiate the class first.

Most of the MFC classes are derived by inheritance from the root class named CObject. CObject provides support for serializing data and obtaining run-time class information, although you don’t need to derive new classes from CObject if you don’t need these capabilities. Other classes in MFC include the following:

  • MFC application architecture classes, which supply common functionality to most applications and create the framework for an application. The AppWizard uses these classes to create new applications.
  • Windows, dialog, and control classes for creating and managing windows.
  • Drawing and printing classes for encapsulating device contexts for graphical output and creating drawing tools such as brushes, palettes, and bitmaps.
  • Data type, array, list, and map classes for handling data of various types.
  • File and database classes for storing and retrieving files in databases or on disks. These include classes for file I/O, Data Access Objects (DAO), and open database connectivity (ODBC).
  • Internet and networking classes for exchanging information between computers and over the Internet. These include classes for Windows Sockets and Internet Server API (ISAPI).
  • OLE classes for creating compound documents and OLE objects, using Automation, creating ActiveX controls, and so on.
  • Debugging and exception classes for error handling and debugging applications.