Microsoft Foundation Classes

From Free net encyclopedia

MFC redirects here. For other meanings of the acronym MFC, see MFC (disambiguation).

Microsoft Foundation Classes, or MFC, is a Microsoft library that wraps portions of the Windows API in [[C++]] classes, forming an application framework. Classes are defined for many of the handle-managed Windows objects and also for predefined windows and common controls.

Contents

History

MFC was introduced in 1992 with Microsoft's C/C++ 7.0 compiler for use with 16-bit versions of Windows. It was part of an overall Microsoft effort to gain market share for development tools, and was designed to be something of a showcase of the capabilities of the C++ programming language. C++ was just beginning to replace C for development of commercial application software and C/C++ 7.0 was the first of Microsoft's compilers to add C++ support. MFC was inspired by, and owes much of its structure to, the Think Class Library (TCL) on Macintosh, later bought by Symantec.

The Object Windows Library (OWL) was a competing product introduced by Borland around the same time, and was designed for use with Borland's Turbo C compiler. Since it more strictly followed some OO design guidelines, OWL was more popular than MFC for a time. However, it lost market share when OWL updates lagged the addition of new features to Windows. Borland then chose to release a new version of their OWL framework which was incompatible with earlier editions. A decision by Borland was made to discontinue OWL devlopment and Borland began licensing MFC from Microsoft.

Features

When MFC was introduced, Microsoft extended the C++ syntax with a series of macros for management of windows messages, exceptions, run time type identification, and dynamic class instantiation (many of these features – exceptions or run time type identification, for example – were not built into Microsoft's compiler at the time, but would appear in future versions). The syntactic changes for windows messages were intended to reduce memory required by avoiding gratuitous vtable use and provide a more concrete structure for various Visual C++-supplied tools to edit and manipulate code without parsing the full language. The message-handing macros replaced virtual function mechanism provided by C++. Because some versions of the macros defeated the type checking done by the compiler, their use has been a fruitful source of bugs for users of MFC. The macros which implemented serialization, exception support, and dynamic runtime types were less problematic, and predated availability of standards-based language extensions by a number of years. 32-bit versions of MFC, for Windows NT 3.1 and later Windows operating systems, retained these features in the interest of compatibility.

As a practical matter, the chief advantage of MFC is that it provides an object-oriented programming model to the Windows APIs. Another advantage of MFC are C++ wrapper types for many common Windows resource-related data types that provide automatic closure of handles when the objects creating them go out of scope. Additionally, MFC provides a Document/View framework for creating Model-View-Controller-based architectures. One main disadvantage of MFC is that it is not portable across many operating systems.

The future of MFC

Once highly promoted by Microsoft, emphasis on MFC has been eclipsed by a number of other technologies. Microsoft placed more emphasis on Visual Basic as a commercial software development tool as it became clear that C++ and MFC were too complex for many programmers. Windows Forms is the .NET RAD successor to Visual Basic and MFC. Native C++ programs can use Windows Forms by adding [[C++ Managed Extensions]].

MFC is however still officially supported by Microsoft, and new releases are developed for each new version of Microsoft Visual Studio. MFC also continues to be used for new development by shops that have made a strategic commitment to C++ and the Windows platform.

See also

External links

Official sites

Tips

[[Category:C++ libraries]]de:Microsoft Foundation Classes fr:Microsoft foundation class he:Microsoft Foundation Classes nl:Microsoft Foundation Classes pt:MFC zh:MFC