HOME

TheInfoList



OR:

Microsoft Foundation Class Library (MFC) is a
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pro ...
library A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vir ...
for developing desktop applications for
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
. MFC was introduced by
Microsoft Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
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 In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
for use with
16-bit 16-bit microcomputers are microcomputers that use 16-bit microprocessors. A 16-bit register can store 216 different values. The range of integer values that can be stored in 16 bits depends on the integer representation used. With the two mos ...
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 Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
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 In computer programming, a precompiled header (PCH) is a ( C or C++) header file that is compiled into an intermediate form that is faster to process for the compiler. Usage of precompiled headers may significantly reduce compilation time, espe ...
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 Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such a ...
. MFC 9.0 was released with Visual Studio 2008. On April 7, 2008,
Microsoft Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
released an update to the MFC classes as an out-of-band update to
Visual Studio 2008 Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including web site, websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platfor ...
and MFC 9. The update features new user interface constructs, including the
ribbons A ribbon or riband is a thin band of material, typically cloth but also plastic or sometimes metal, used primarily as decorative binding and tying. Cloth ribbons are made of natural materials such as silk, cotton, and jute and of synthetic mater ...
and associated UI widgets, fully customizable
toolbar The toolbar, also called a bar or standard toolbar (originally known as ribbon) is a graphical control element on which on-screen icons can be used. A toolbar often allows for quick access to functions that are commonly used in the program. Some ...
s, 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 Microsoft Visual Studio Express is a set of integrated development environments (IDEs) that Microsoft developed and released free of charge. They are function-limited version of the non-free Visual Studio and require mandatory registration. Exp ...
. The Community edition of Visual Studio, introduced in 2014, however, includes MFC.
Object Windows Library The Object Windows Library (OWL) is a C++ object-oriented application framework designed to simplify desktop application development for Windows and (some releases) OS/2. OWL was introduced by Borland in 1991 and eventually deprecated in 1997 i ...
(OWL), designed for use with Borland's
Turbo C++ Turbo C++ is a discontinued C++ compiler and integrated development environment originally from Borland. It was designed as a home and hobbyist counterpart for Borland C++. As the developer focused more on professional programming tools, later T ...
compiler, was a competing product introduced by
Borland Borland Software Corporation was a computer technology company founded in 1983 by Niels Jensen, Ole Henriksen, Mogens Glad and Philippe Kahn. Its main business was the development and sale of software development and software deployment product ...
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 A wrap is a food dish made with a soft flatbread rolled around a filling. The usual flatbreads are wheat tortillas, lavash, or pita; the filling may include cold sliced meat, poultry, or fish, shredded lettuce, diced tomato or pico de gallo, g ...
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 int ...
. Classes are defined for many of the
handle A handle is a part of, or attachment to, an object that allows it to be grasped and manipulated by hand. The design of each type of handle involves substantial ergonomic issues, even where these are dealt with intuitively or by following tra ...
-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) is the process of translating a data structure or object state into a format that can be stored (e.g. files in secondary storage devices, data buffers in primary storage devices) or transmitted (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). When ...
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, in languages such as C++, and Object Pascal, a virtual function or virtual method is an inheritable and overridable function or method for which dynamic dispatch is facilitated. This concept is an important part o ...
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 32-bit units. Compared to smaller bit widths, 32-bit computers can perform large calculation ...
versions of MFC, for
Windows NT 3.1 Windows NT 3.1 is the first major release of the Windows NT operating system developed by Microsoft, released on July 27, 1993. At the time of Windows NT's release, Microsoft's Windows 3.1 desktop environment had established brand recognition ...
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 arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. T ...
-based declarative markup like the RibbonX
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standa ...
. 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 is building 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, or simply Office, is the former name of a family of client software, server software, and services developed by Microsoft. It was first announced by Bill Gates on August 1, 1988, at COMDEX in Las Vegas. Initially a marketin ...
. MFC can be used by linking a
static library In computer science, a static library or statically-linked library is a set of routines, external functions and variables which are resolved in a caller at compile-time and copied into a target application by a compiler, linker, or binder, produci ...
or by adding the MFC DLL.


Versions


See also

*
Active Template Library The Active Template Library (ATL) is a set of template-based C++ classes developed by Microsoft, intended to simplify the programming of Component Object Model (COM) objects. The COM support in Microsoft Visual C++ allows developers to create a v ...
(ATL) *
GTK GTK (formerly GIMP ToolKit and GTK+) is a free and open-source 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 and propriet ...
*
gtkmm gtkmm (formerly known as gtk-- or gtk minus minus) is the official C++ interface for the popular GUI library GTK. gtkmm is free software distributed under the GNU Lesser General Public License (LGPL). gtkmm allows the creation of user interface ...
*
JUCE JUCE is an open-source cross-platform C++ application framework, used for the development of desktop and mobile applications. JUCE is used in particular for its GUI and plug-ins libraries. It is dual licensed under the GPLv3 and a commercial l ...
* Qt *
Standard Template Library The Standard Template Library (STL) is a Library (computer science), software library originally designed by Alexander Stepanov for the C++ programming language that influenced many parts of the C++ Standard Library. It provides four components ...
(STL) *
Windows Template Library Windows Template Library (WTL) is a free software, object-oriented C++ template library for Win32 development. WTL was created by Microsoft employee Nenad Stefanovic for internal use and later released as an unsupported add-on to Visual Studio and ...
(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 mini ...


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 {{Widget toolkits C++ libraries Application programming interfaces Microsoft application programming interfaces Widget toolkits