Visual C++ Programming: What’s new for MFC library in VC++ 2010?

Some years ago I thought that MFC will be obsolete, and no new features will be added, but I was wrong, VS2008 added many features and functionalities, and with VS 2010 I discovered new improvements.

So what’s new in MFC 10? to answer to this question I tried to compare the two versions MFC 9 and MFC 10 using CppDepend.

Removed classes:

Let’s begin with breaking changes and search for removed classes:

SELECT TYPES WHERE WasRemoved



It was very strange that this class is removed , and to be sure I searched in the code source and I found it inside #ifdef ENABLE_RIBBON_LAUNCH_BUTTON statement.

The only resource I found in the web talking about this change is here , and I dont know if
adding #define ENABLE_RIBBON_LAUNCH_BUTTON is suficient to compile without problem.

Added Classes:

SELECT TYPES WHERE WasAdded AND isClass



What’s the new features added by these classes?

CMFCRibbonCollector,CMFCRibbonConstructor,CMFCRibbonInfo:

When I searched in MSDN the utility of these classes , I didnt found any useful informations, so I searched for methods using CMFCRibbonInfo.

SELECT METHODS WHERE IsDirectlyUsing “CMFCRibbonInfo



The RibbonBar class use CMFCRibbonInfo to save it to xml or load it.

CJumpList,CAppDestinations:

jump list is a new useful Window7 feature, it adds a new way of interaction beteween user and application.

here’s a good article to add JumpList feature with MFC.

CMFCControlContainer:

This class provides a CWnd support for MFC Control containment of Feature Pack controls.

And to know which controls can be contained inside this container, let’s search for classes used by CMFCControlContainer::CreateDlgControl.

Here’s the result:

So only these MFC feature pack controls are concerned by this container.

CDocument::CDocumentAdapter:

This class implements ATL::IDocument interface required for “Search and Organize” feature.

My first impression when i discovered that implemention was ” WOW, MFC use now interfaces to enforce low coupling”.

Let’s see the impact of using this interface, for that let’s search for classes using CDocumentAdapter :

SELECT TYPES WHERE IsDirectlyUsing “CDocument+CDocumentAdapter

Only CDocument use directly this class.

However IDocument is used by other classes like the new class CMFCPreviewCtrlImpl, so this class can work with CDocumentAdapter and also others classes implementing this interface.

And as explained in the comment of CDocumentAdapter code source:

“Search and Organize handlers are implemented in ATL DLLs, which can be MFC or not-MFC based.Internally handlers refer to IDocument interface, whose implementation in the common case should be supplied by a developer. CDocumentAdapter provides this implementation for MFC and basically calls the appropriate methods of the parent CDocument.”

CDataRecoveryHandler:
This class autosaves documents and restores them if an application unexpectedly exits, it’s used by Restart Manager feature, here’s an interesting article talking about it.

Let’s search for classes used by CDataRecoveryHandler:

SELECT TYPES WHERE IsDirectlyUsedBy “CDataRecoveryHandler

CDataRecoveryHandler is highly coupled with other MFC classes like CDocument, CWinApp, CWnd.

Which MFC classes use the recovery feature?

SELECT TYPES WHERE IsDirectlyUsing “CDataRecoveryHandler


So all these classes benefit of this new feature especially CDocument.

CTaskDialog:

A pop-up dialog box that functions like a message box but can display additional information to the user.

here’s an interesting article talking about this feature.

CMFCVisualManagerVS2008,CMFCVisualManagerWindows7:

Gives an application the apparence of a VS2008 or Windows 7 application.

CGestureConfig:

Used for touch feature.

CFolderPickerDialog:

CFolderPickerDialog class implements CFileDialog in the folder picker mode.

CXMLParser,CXMLParserCollection,CXMLParserRoot:

when I dsicovered these classes, I thought that is concerning xml parsing but when I searched for methods using them I discovered that only CMFCRibbonInfo use them to save or load its description to xml files.

SELECT METHODS WHERE IsDirectlyUsing “CXMLParserRoot


CMFCZoomKernel,CMFCScanliner, CMFCScanlinerBitmap :

Not yet documented in MSDN, let’s discover which classes use them.

SELECT TYPES WHERE IsDirectlyUsing “CMFCZoomKernel


And we have the same result for the two other classes.

More by Author

Must Read