Microsoft Foundation Classes Article Index for
Microsoft
Website Links For
Microsoft
 

Information About

Microsoft Foundation Classes




In Computer Programming , Microsoft Foundation Class Library (also '''Microsoft Foundation Classes''' or '''MFC''', originally '''Application Framework eXtensions''' or '''AFX''') 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.


HISTORY

MFC was introduced in 1992 with Microsoft's ''C/C++ 7.0'' Compiler for use with 16-bit versions of Windows . 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.

One interesting quirk of MFC is the use of "Afx" as the prefix for many functions, macros and the standard pre-compiled 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. Microsoft Codenamed "Acropolis" – Composite Client Application Builder for .NET

MFC 8.0 was released with Visual Studio 2005 . MFC is not included in the free edition of Visual C++ 2005 Express.

The ) to replace the OWL framework.


FEATURES

When MFC was introduced, Microsoft extended the C++ syntax with a series of Macro s for management of Windows messages (via Message_Maps ), 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 macros for Windows messages were intended to reduce memory required by avoiding gratuitous Virtual Table 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-handling macros replaced the Virtual Function mechanism provided by C++.

The macros which implemented serialization, exception support, and dynamic runtime types 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, 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.


ADVANTAGES

  • Provides an object-oriented programming model to the Windows APIs.

  • 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 .

  • Provides a ''Document/View'' framework for creating Model-View-Controller -based architectures.

  • Provides utility classes such as CString and collection classes, which are usable even by console applications.

  • Faster executables than produced by interpreters like Visual Basic.

  • Generally faster executables than those produced by the .NET Framework.

  • Developer can use native Windows API seamlessly with MFC classes.

  • Capable IDE ( Integrated Development Environment ) for debugging and code development.

  • Relatively small GUI executables, especially if the DLL version of MFC is used; executables do not require the end-user to download and install the .NET Framework, which is 22.4 MB. The current MFC redistributable package is 2.6 MB. (Statically linking to MFC adds a 250k-500k overhead for a typical application.)

  • Numerous ''wizards'' are available for a variety of tasks.

  • Integration with resource editor and, especially, the dialog box editor.

  • Large number of MFC developers, which means that its easier to get help and easier to hire someone who knows MFC.

  • Large amount of resources available, including books, websites, sample code and third party libraries

  • Fast compilation speed.

  • Similar Code Base (but typically not completely the same) can be used for desktop and Pocket PC applications.

  • MFC applications are easily migrated to newer versions.



DISADVANTAGES

  • Minimally portable to other operating systems

  • --- Mainsoft has made MFC tools available for Unix {Link without Title} ,

  • --- Microsoft shipped MFC versions for the Apple Macintosh operating systems in the 1990s. Visual Studio support for the Macintosh has since been discontinued.

  • --- Desktop and Pocket PC versions are similar, but not completely compatible

  • --- Migrating MFC applications back to Windows 3.x is problematic (though quite uncommon.)

  • Large library with a significant learning curve

  • Alternatives such as VCL, Visual Basic and C# provide Rapid Application Development (RAD)

  • It is not clear to what extent Microsoft actually used MFC for internal development of the software they market (cf. Eating One's Own Dog Food ). For example, Microsoft reportedly uses C/C++ along with a specialized framework for most of the development of their Office suite.

  • Still requires varying degrees of knowledge of the underlying Windows API depending on how much non-MFC wrapped and custom Windows API code is needed.

  • Does not provide a complete abstraction layer interface to the underlying Windows API, requiring custom Windows API code for those portions not covered by MFC.

  • .NET does a much better job at providing a well organized, object oriented API.

  • Early versions of the MFC DLLs did not have names changed between revisions, resulting in DLL Hell problems. (This has been resolved with Visual Studio 2005 and MFC 8.0.)



THE FUTURE OF MFC

Once promoted heavily by Microsoft, emphasis on MFC has been eclipsed by the .NET Framework. Due to demand, development has continued. MFC 8 gained support for bridging elements of MFC with the .NET Framework to aid developers in migrating to the new API. Future versions of MFC will fully support the new dialog boxes of Windows Vista and many native Vista features. A 'leaner, meaner' alternative to MFC is the Windows Template Library (WTL), but Microsoft never fully supported it with wizards and other IDE features, and has since released it under open source licenses: Common Public License 1.0 (CPL) and Microsoft Permissive License (Ms-PL).

Recently (August 2007), Bill Dunlap of the Visual C++ Development Team teased in a comment on a blog post that they are working on "we are working on a huge update to MFC that should knock your socks off". Somasegar's WebLog : Visual C++ Futures

The free Visual C++ Express version will compile MFC applications, but does not include the IDE support of the standard, professional and Team editions. Visual C++ Express Overview Vendors and computer programmers that have made a strategic commitment to C++ and the Windows platform continue to use MFC for new development.


VERSIONS



SEE ALSO



REFERENCES



FURTHER READING



EXTERNAL LINKS


Official sites



Tips