Microsoft Foundation Classes

from Wikipedia, the free encyclopedia

The Microsoft Foundation Classes (MFC) are a collection of object-oriented class libraries ( GUI toolkit ) that were developed by Microsoft for programming applications with graphical user interfaces for Windows with C ++ .


Microsoft introduced the MFC in 1992 with its own compiler for C ++ and C. The MFC are supplied with various Microsoft C ++ compilers and are part of the full versions of the integrated development environment Microsoft Visual Studio . The free Visual Studio Express editions do not include the MFC. In November 2014, however, Microsoft released the free Visual Studio Community 2013, which - like Visual Studio 2013 Professional and higher - includes the MFC. Since Windows 2000, one or more MFC program libraries have often been included in an operating system installation .

In order to use translated MFC programs, it is often not necessary to install a runtime library , as the "Visual Studio C ++ 20XX Runtime", which in turn contains the MFC runtime, is already installed on many Windows systems.

A characteristic of MFC is the use of "Afx" as a prefix for many functions, macros and its occurrence in the standard precompiled header name "stdafx.h", which is due to the fact that in the early development of MFC these were initially called "Application Framework Extensions" and were abbreviated with "Afx". It wasn't until much later that “Afx” was renamed MFC - so late that these references could no longer be changed.

In addition to further development by the manufacturer with extensive downward compatibility, there are numerous additions by commercial providers and detailed documentation. All controls used in Windows can be used. Current components from Windows and other Microsoft products (e.g. ribbons ) are available in the MFC, as well as the current Aero design.


The MFC serve as interface to the non-object-oriented WinAPI and are dealing with the provided by the operating system available resources greatly simplify. The MFC thus represent an implementation of the adapter design pattern - instead of just being able to use the Win32 API functions directly , the programmer can now use the MFC classes as adapters.

The MFC support a modification of the Model-View-Controller - Architecture pattern . The classes CDocument and CView are made available, whereby the model, i.e. the data holder, is implemented with CDocument and both view and control are implemented with CView. The wizard included in Microsoft Visual Studio enables frameworks to be created automatically using this architecture.

Alternative libraries

Well-known alternatives to the MFC are, for example, the Active Template Library (ATL, also Microsoft), also in combination with the Windows Template Library (WTL, released by Microsoft as Open Source ), and the Visual Component Library ( Borland ). The .NET platform uses a system called Windows Forms , which was influenced by the MFC (and the Thunderforms system from Visual Basic ). Unlike MFC is for GUI development there was not a pure C ++, but Microsoft - C ++ -Spracherweiterung C ++ / CLI used. Cross-platform alternatives are Qt and wxWidgets - both based on C ++ - or GTK + - based on C. They also have language connections for Java , Perl , Python , Ruby and other languages.


  • Frank Budszuhn: Visual C ++. Student edition. Windows programming with the MFC. Addison-Wesley, 2004, ISBN 3-8273-2175-1 .
  • George Shepherd, David J. Kruglinski: Inside Visual C ++ .NET . Microsoft Press Germany, 2003, ISBN 3-86063-678-2 .
  • Jeff Prosise: Programming Windows with MFC Second Edition . Microsoft Press Books, 1999, ISBN 1-57231-695-0 .

Web links

Individual evidence

  1. ^ MFC . WEBOPEDIA. Retrieved June 15, 2011: “Short for Microsoft Foundation Classes, a large library of C ++ classes developed by Microsoft. For Windows-based applications written in C ++, MFC provides an enormous headstart. One of the hardest parts of developing C ++ programs is designing a logical hierarchy of classes. With MFC, this work has already been done. "