HOME

TheInfoList



OR:

Microsoft Foundation Class Library (MFC) is a C++ object-oriented
library A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
for developing desktop applications for
Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
. MFC was introduced by
Microsoft Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
in 1992 and quickly gained widespread use. While Microsoft has introduced alternative application frameworks since then, MFC remains widely used.


History

MFC was introduced in 1992 with Microsoft's ''C/C++ 7.0'' compiler for use with 16-bit versions of Windows as an extremely thin object-oriented C++ wrapper for the Windows API. C++ was just beginning to replace C for development of commercial application software at the time. In an MFC program, direct
Windows API The Windows API, informally WinAPI, is the foundational application programming interface (API) that allows a computer program to access the features of the Microsoft Windows operating system in which the program is running. Programs can acces ...
calls are rarely needed. Instead, programs create objects from Microsoft Foundation Class classes and call member functions belonging to those objects. Many of those functions share their names with corresponding API functions. One quirk of MFC is the use of "Afx" as the prefix for many functions, macros and the standard precompiled header name "stdafx.h". During early development, what became MFC was called "Application Framework Extensions" and abbreviated "Afx". The name Microsoft Foundation Classes (MFC) was adopted too late in the release cycle to change these references. MFC 8.0 was released with Visual Studio 2005. MFC 9.0 was released with Visual Studio 2008. On April 7, 2008, Microsoft released an update to the MFC classes as an out-of-band update to Visual Studio 2008 and MFC 9. The update features new user interface constructs, including the ribbons and associated UI widgets, fully customizable toolbars, docking panes which can either be freely floated or docked to any side and document tabs. MFC was initially a feature of the commercial versions of Visual Studio. As such, it is not included in the freeware Visual C++ Express. The Community edition of Visual Studio, introduced in 2014, however, includes MFC. Object Windows Library (OWL), designed for use with Borland's Turbo C++ compiler, was a competing product introduced by Borland around the same time. Eventually, Borland discontinued OWL development and licensed the distribution of the MFC headers, libraries and DLLs from Microsoft for a short time, though it never offered fully integrated support for MFC. Borland later released
Visual Component Library The Visual Component Library (VCL) is a visual component-based object-oriented framework for developing the user interface of Microsoft Windows applications. It is written in Object Pascal. History The VCL was developed by Borland for use i ...
to replace the OWL framework.


Features

MFC is a library that wraps portions of the Windows API in C++ classes, including functionality that enables them to use a default
application framework In computer programming, an application framework consists of a software framework used by software developers to implement the standard structure of application software. Application frameworks became popular with the rise of graphical user inte ...
. Classes are defined for many of the
handle A handle is a part of, or an attachment to, an object that allows it to be grasped and object manipulation, manipulated by hand. The design of each type of handle involves substantial ergonomics, ergonomic issues, even where these are dealt wi ...
-managed Windows objects and also for predefined windows and common controls. At the time of its introduction, MFC provided C++ macros for Windows message-handling (via Message Maps ), exceptions, run-time type identification (RTTI),
serialization In computing, serialization (or serialisation, also referred to as pickling in Python (programming language), Python) is the process of translating a data structure or object (computer science), object state into a format that can be stored (e. ...
and dynamic class instantiation. The macros for message-handling aimed to reduce memory consumption by avoiding gratuitous
virtual table In computer programming, a virtual method table (VMT), virtual function table, virtual call table, dispatch table, vtable, or vftable is a mechanism used in a programming language to support dynamic dispatch (or run-time method binding). Wh ...
use and also to provide a more concrete structure for various Visual C++-supplied tools to edit and manipulate code without parsing the full language. The message-handling macros replaced the
virtual function In object-oriented programming such as is often used in C++ and Object Pascal, a virtual function or virtual method is an inheritable and overridable function or method that is dispatched dynamically. Virtual functions are an important part ...
mechanism provided by C++. The macros for serialization, exceptions, and RTTI predated availability of these features in Microsoft C++ by a number of years.
32-bit In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in a maximum of 32- bit units. Compared to smaller bit widths, 32-bit computers can perform la ...
versions of MFC, for Windows NT 3.1 and later Windows operating systems, used compilers that implemented the language features and updated the macros to simply wrap the language features instead of providing customized implementations, realizing upward compatibility. The MFC ribbon resource editor allows the developer to design the ribbon graphically instead of having to use the
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
-based declarative markup like the RibbonX
API An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
. Optionally, ribbon components may be programmed directly by calling a new set of ribbon class methods. The developer may mix graphical and programmatic ribbon development as is convenient. The MFC application wizard has also been upgraded to support the new features, including a check-box to select whether the application will use the ribbon or the docking panes. The new functionality is provided in new classes so that old applications still continue to run. This update builds on top of BCGSoft’s BCGControlBar Library Professional Edition. Microsoft has imposed additional licensing requirements on users of the ribbons. These include a requirement to adhere to Microsoft UI Design Guidelines, and an anti-competition clause prohibiting the use of the UI in applications which compete with
Microsoft Office Microsoft Office, MS Office, or simply Office, is an office suite and family of client software, server software, and services developed by Microsoft. The first version of the Office suite, announced by Bill Gates on August 1, 1988, at CO ...
. MFC can be used by linking a
static library A static library or statically linked library contains functions and data that can be included in a consuming computer program at build-time such that the library does not need to be accessible in a separate file at run-time. If all libraries a ...
or by adding the MFC DLL.


Versions


See also

* Active Template Library (ATL) *
GLib GLib is a bundle of three (formerly five) low-level system libraries written in C and developed mainly by GNOME. GLib's code was separated from GTK, so it can be used by software other than GNOME and has been developed in parallel ever since ...
*
GTK GTK (formerly GIMP ToolKit and GTK+) is a free software cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both Free software, free and ...
* gtkmm *
JUCE JUCE is an open-source software, open-source cross-platform C++ application framework, used for the development of desktop and mobile applications. JUCE is used in particular for its graphical user interface, GUI and Plug-in (computing), plug-in ...
* Qt * Standard Template Library (STL) * Windows Template Library (WTL) *
WxWidgets wxWidgets (formerly wxWindows) is a widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with no s ...


Notes


References


Further reading

* * * *


External links


The latest supported Visual C++ downloads
- Microsoft
Where can I download Visual C++ Redistributables?
- Microsoft
MSDN MFC Reference
- Microsoft
MFC: Visual Studio 2005 and Beyond
- Microsoft
An Inside Look At The Next Generation Of Visual C++
(covers the major MFC 9 updates) - Microsoft {{Authority control C++ libraries Microsoft application programming interfaces Widget toolkits