Click here to Skip to main content
15,880,725 members
Articles / Programming Languages / VC++

Visual C++ 2010: What’s New for MFC Library?

Rate me:
Please Sign up or sign in to vote.
4.43/5 (7 votes)
30 Aug 2010CPOL5 min read 30.4K   18   2
Visual C++ 2010: What’s new for MFC library?

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

Image 1

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 don't know if

adding #define ENABLE_RIBBON_LAUNCH_BUTTON is sufficient to compile without problem.

Added Classes

SELECT TYPES WHERE WasAdded AND isClass

Image 2

What are the new features added by these classes?

CMFCRibbonCollector, CMFCRibbonConstructor, CMFCRibbonInfo

When I searched in MSDN the utility of these classes, I didn't find any useful information, so I searched for methods using CMFCRibbonInfo.

SELECT METHODS WHERE IsDirectlyUsing “CMFCRibbonInfo“

Image 3

The RibbonBar class uses 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 between user and application.

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

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“

Image 4

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

Which MFC classes use the recovery feature?

SELECT TYPES WHERE IsDirectlyUsing “CDataRecoveryHandler“

Image 5

So all these classes benefit 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 I discovered these classes, I thought that is concerning XML parsing but when I searched for methods using them, I discovered that only CMFCRibbonInfo uses them to save or load its description to XML files.

SELECT METHODS WHERE IsDirectlyUsing “CXMLParserRoot“

Image 6

CMFCZoomKernel,CMFCScanliner, CMFCScanlinerBitmap

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

SELECT TYPES WHERE IsDirectlyUsing “CMFCZoomKernel“

Image 7

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.

Methods Removed

SELECT METHODS WHERE WasRemoved

Image 8

Almost all these 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.

Methods Added

Let’s search for all methods added to MFC10

SELECT METHODS WHERE WasAdded

Image 9

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.

Image 10

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.

CRecentFileList

Image 11

New possibilities to add item to recent file list are now available.

CDocument

Here’s the methods added by CDocument:

Image 12

Two new features concern methods added:

  • Supporting Windows Search with MFC
  • 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.

Image 13

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:

Image 14

A good news is that we can now customize CFileDialog by adding what we want in the dialog.

CMDIChildWndEx

Here are the methods added by CMDIChildWndEx:

Image 15

Windows7 add a new interesting features like: taskbar Tabs,Taskbar thumbnails and thumbnail previews, and almost all methods added to CMDIChildWndEx concern these features.

CFrameWnd

Windows 7 also adds some useful features like OverlayIcon and progressbar in the taskbar, and the methods added to CFrameWnd concern these features.

Image 16

CWinApp

Almost all methods added to CWinApp concern the ApplicationRecovery support.

Image 17

Other useful methods are added like CMFCControlRenderer::SmoothResize and CDrawingmanager::DrawRotated.

Methods where visibility was changed

SELECT METHODS WHERE VisibilityWasChanged

Image 18

Almost the visibility of all CMFCRibbonTab methods is changed from private to public.

But when I checked the code source the only modification in the class declaration is the adding of DECLARE_DYNAMIC(CMFCRibbonTab), this macro include “public:”, so I wonder if this visibility change is only a side effect of adding this macro.

Methods Not Used Anymore

Some methods become obsolete when upgrading framework version, did MFC10 not use anymore some methods?

To answer this question, let’s execute the query:

SELECT METHODS WHERE IsNotUsedAnymore

Here’s the result:

Image 19

Theses methods was declared before in multimon.h, the origin of this file goes back to Windows 98 to let compatibility with Windows 95 in the case of multi monitor, here’s an interesting article talking about it.

In MFC10, this file is no longer included in mfc files. and MFC10 use directly GetSystemMetrics instead of xGetSystemMetrics.

Filed under: CodeProject

Image 20 Image 21 Image 22 Image 23 Image 24 Image 25 Image 26 Image 27

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions

 
GeneralGood Information Pin
thakurbond6-Sep-10 18:27
thakurbond6-Sep-10 18:27 
GeneralRe: Good Information Pin
Anant wakode5-May-11 20:25
Anant wakode5-May-11 20:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.