Some years ago we thought that MFC will be obsolete, and no new features will be added, but we was wrong, VS2008 added many features and functionalities, and with VS 2010 we discovered new improvements.
So what's new in MFC 10? to answer to this question we tried to compare the two versions MFC 8 and MFC 10 using CppDepend.
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 we searched in the code source and we found it inside #ifdef ENABLE_RIBBON_LAUNCH_BUTTON statement.
The only resource we found in the web talking about this change is here , and we don't know if adding #define ENABLE_RIBBON_LAUNCH_BUTTON is suficient to compile without problem.
What's the new features added by these classes?
CMFCRibbonCollector, CMFCRibbonConstructor, CMFCRibbonInfo: When we searched in MSDN the utility of these classes , we didnt found any useful informations, so we searched for methods using CMFCRibbonInfo.SELECT METHODS WHERE IsDirectlyUsing "CMFCRibbonInfo"
The RibbonBar class use CMFCRibbonInfo to save it to xml or load it.
jump list is a new useful Window7 feature, it adds a new way of interaction between user and application. here's a good article to add JumpList feature with MFC.
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 appearance 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 we discovered these classes, we thought that is concerning xml parsing but when we searched for methods using them we 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.
SafeInt classes: Extends the integer primitives to help prevent integer overflow and lets you compare different types of integers.
here's a video about using SafeInt.
After detecting which classes are added and removed, let's discover all methods removed or added to MFC10, and which features are implemented by these methods.
Almost all theses methods are not removed but only the signature is changed , and some optional parameters are added, however some methods are removed like CCommandManager::ResetAllImages or CPanelDialog::ClipPaint, and one method was renamed from CMFCRibbonBar::GetTabTrancateRatio to CMFCRibbonBar::GetTabTruncateRatio.
Let's search for all methods added to MFC10SELECT METHODS WHERE WasAdded
Which features are added by these new methods?
For that we will focus only in the most used classes.
CWnd: Here's the methods added for CWnd, and almost all methods added concern touch feature and touch gestures.
CFile, CStdioFile, CFileFind: Many methods of these classes add CAtlTransactionmanager as optional parameter.
Transactional File System is a new technology first introduced in Windows Vista. It enables you to roll back operations made on the file system and registry.
here's a good article about this feature.
New possibilities to add item to recent file list are now available.
CDocument: Here's the methods added by CDocument:
Two new features concern methods added : Supporting Windows Search with MFC and Rich Preview
Let's discover the changes concerning dependency of CDocument to other MFC classes,and which additional dependencies are added in MFC10, for that Dependency Matrix can be useful, and the sign "+" in the cell representing the dependency indicate that this dependency is new.
So many dependencies are added, especially with new classes added to MFC10 like CDataRecoveryHandler,and also some other inner classes added to CDocument.
CFileDialog: Here's the methods added by CFileDialog:
A good news is we can now customize CFileDialog by adding what we want in the dialog.
CMDIChildWndEx: Here's the methods added by CMDIChildWndEx:
Windows7 add a new interesting features like:taskbar Tabs,Taskbar thumbnails and thumbnail previews, and almost all methods added to CMDIChildWndEx concern theses features.
CFrameWnd: Windows 7 add also some useful features like OverlayIcon and progressbar in the taskbar, and the methods added to CFrameWnd concern these features.
CWinApp: Almost all methods added to CWinApp concern the ApplicationRecovery support.
Other useful methods are added like CMFCControlRenderer::SmoothResize and CDrawingmanager::DrawRotated.
Almost the visibility of all CMFCRibbonTab methods is changed from private to public.
But when we checked the code source the only modification in the class declaration is the adding of DECLARE_DYNAMIC(CMFCRibbonTab) , this macro include "public:" , so we wonder if this visibility changes is only a side effect of adding this macro.