
{"id":78,"date":"2014-05-05T11:01:55","date_gmt":"2014-05-05T11:01:55","guid":{"rendered":"http:\/\/www.codergears.com\/Blog\/?p=78"},"modified":"2014-08-28T13:43:26","modified_gmt":"2014-08-28T13:43:26","slug":"comparing-mfc10-to-mfc9","status":"publish","type":"post","link":"https:\/\/codergears.com\/Blog\/?p=78","title":{"rendered":"Comparing MFC10 to MFC9"},"content":{"rendered":"<h2>Visual C++ 2010: MFC new features<\/h2>\n<p>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.<\/p>\n<p>So what&#8217;s new in MFC 10?<br \/>\nTo answer to this question i tried to compare the two versions MFC 8 and MFC 10 using CppDepend.<\/p>\n<h2>Removed classes<\/h2>\n<p>Let&#8217;s begin with breaking changes and search for removed classes:<\/p>\n<p><span style=\"color:rgb(51,102,255);\">SELECT TYPES WHERE<\/span> WasRemoved<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img1.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<h2>Added Classes<\/h2>\n<p><span style=\"color:rgb(51,102,255);\">SELECT TYPES WHERE<\/span> WasAdded <span style=\"color:rgb(51,102,255);\">AND <\/span>isClass<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img2.png\" class=\"bordered\" alt=\"\"><\/p>\n<p><strong>What&#8217;s the new features added by these classes?<\/strong><br \/>\n<strong><br \/>\nCMFCRibbonCollector, CMFCRibbonConstructor, CMFCRibbonInfo: <\/strong><br \/>\nWhen i searched in MSDN the utility of these classes , i didnt found any useful informations, so i searched for methods using CMFCRibbonInfo.<\/p>\n<p><span style=\"color:rgb(51,102,255);\">SELECT METHODS WHERE<\/span> IsDirectlyUsing &#8220;<span style=\"color:rgb(255,102,102);\">CMFCRibbonInfo<\/span>&#8221;<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img3.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>The RibbonBar class use CMFCRibbonInfo to save it to xml or load it.<\/p>\n<p><strong>CJumpList, CAppDestinations:<\/strong><\/p>\n<p>Jump list is a new useful Window7 feature, it adds a new way of interaction between user and application.<br \/>\nhere&#8217;s a good article to add JumpList feature with MFC.<\/p>\n<p><strong>CDataRecoveryHandler:<\/strong><\/p>\n<p>This class autosaves documents and restores them if an application unexpectedly exits, it&#8217;s used by Restart Manager feature, here&#8217;s an interesting article talking about it.<\/p>\n<p>Let&#8217;s search for classes used by CDataRecoveryHandler:<\/p>\n<p><span style=\"color:rgb(51,102,255);\">SELECT TYPES WHERE<\/span> IsDirectlyUsedBy &#8220;<span style=\"color:rgb(255,0,0);\">CDataRecoveryHandler<\/span>&#8221;<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img3.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>CDataRecoveryHandler is highly coupled with other MFC classes like CDocument, CWinApp, CWnd.<\/p>\n<p><strong><br \/>\nWhich MFC classes use the recovery feature?<\/strong><\/p>\n<p><span style=\"color:rgb(51,102,255);\">SELECT TYPES WHERE<\/span> IsDirectlyUsing &#8220;<span style=\"color:rgb(255,0,0);\">CDataRecoveryHandler<\/span>&#8221;<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img4.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>So all these classes benefit of this new feature especially CDocument.<\/p>\n<p>CTaskDialog:<br \/>\nA pop-up dialog box that functions like a message box but can display additional information to the user.<\/p>\n<p>here&#8217;s an interesting article talking about this feature.<\/p>\n<p><strong><br \/>\nCMFCVisualManagerVS2008, CMFCVisualManagerWindows7: <\/strong><br \/>\nGives an application the appearance of a VS2008 or Windows 7 application.<\/p>\n<p><strong><br \/>\nCGestureConfig: <\/strong><br \/>\nUsed for touch feature.<\/p>\n<p><strong><br \/>\nCFolderPickerDialog: <\/strong><br \/>\nCFolderPickerDialog class implements CFileDialog in the folder picker mode.<\/p>\n<p><strong><br \/>\nCXMLParser, CXMLParserCollection, CXMLParserRoot: <\/strong><br \/>\nWhen i discovered 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.<\/p>\n<p><span style=\"color:rgb(51,102,255);\">SELECT METHODS WHERE<\/span> IsDirectlyUsing &#8220;<span style=\"color:rgb(255,0,0);\">CXMLParserRoot<\/span>&#8221;<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img5.png\" class=\"bordered\" alt=\"\"><\/p>\n<p><strong>CMFCZoomKernel, CMFCScanliner, CMFCScanlinerBitmap:<\/strong><br \/>\nNot yet documented in MSDN, let&#8217;s discover which classes use them.<\/p>\n<p><span style=\"color:rgb(51,102,255);\">SELECT TYPES WHERE<\/span> IsDirectlyUsing &#8220;<span style=\"color:rgb(255,0,0);\">CMFCZoomKernel<\/span>&#8221;<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img6.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>And we have the same result for the two other classes.<\/p>\n<p><strong>SafeInt classes:<\/strong><br \/>\nExtends the integer primitives to help prevent integer overflow and lets you compare different types of integers.<br \/>\nhere&#8217;s a video about using SafeInt.<\/p>\n<p>After detecting which classes are added and removed, let&#8217;s discover all methods removed or added to MFC10, and which features are implemented by these methods.<\/p>\n<h2>Methods Removed<\/h2>\n<p><span style=\"color:rgb(51,102,255);\">SELECT METHODS WHERE<\/span> WasRemoved<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img7.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>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.<\/p>\n<h2>Methods Added<\/h2>\n<p>Let&#8217;s search for all methods added to MFC10<\/p>\n<p><span style=\"color:rgb(51,102,255);\">SELECT METHODS WHERE<\/span> WasAdded<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img8.png\" class=\"bordered\" alt=\"\"><\/p>\n<p><strong>Which features are added by these new methods?<\/strong><\/p>\n<p>For that we will focus only in the most used classes.<\/p>\n<p><strong>CWnd:<\/strong><br \/>\nHere&#8217;s the methods added for CWnd, and almost all methods added concern touch feature and touch gestures.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img9.png\" class=\"bordered\" alt=\"\"><\/p>\n<p><strong>CFile, CStdioFile, CFileFind: <\/strong><br \/>\nMany methods of these classes add CAtlTransactionmanager as optional parameter.<\/p>\n<p>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.<\/p>\n<p>Here&#8217;s a good article about this feature.<\/p>\n<p><strong>CRecentFileList:<\/strong><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img10.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>New possibilities to add item to recent file list are now available.<\/p>\n<p><strong>CDocument:<\/strong> Here&#8217;s the methods added by CDocument:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img11.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>Two new features concern methods added : <strong>Supporting Windows Search with MFC<\/strong> and <strong>Rich Preview<\/strong> <\/p>\n<p>Let&#8217;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 &#8220;+&#8221; in the cell representing the dependency indicate that this dependency is new.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img12.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>So many dependencies are added, especially with new classes added to MFC10 like CDataRecoveryHandler,and also some other inner classes added to CDocument.<\/p>\n<p><strong>CFileDialog:<\/strong> Here&#8217;s the methods added by CFileDialog:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img13.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>A good news is we can now customize CFileDialog by adding what we want in the dialog.<\/p>\n<p><strong>CMDIChildWndEx:<\/strong><br \/>\nHere&#8217;s the methods added by CMDIChildWndEx<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img14.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>Windows7 add a new interesting features like:taskbar Tabs,Taskbar thumbnails and thumbnail previews, and almost all methods added to CMDIChildWndEx concern theses features.<\/p>\n<p><strong>CFrameWnd:<\/strong><br \/>\nWindows 7 add also some useful features like OverlayIcon and progressbar in the taskbar, and the methods added to CFrameWnd concern these features.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img15.png\" class=\"bordered\" alt=\"\"><\/p>\n<p><strong>CWinApp:<\/strong><br \/>\nAlmost all methods added to CWinApp concern the ApplicationRecovery support.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img16.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>Other useful methods are added like CMFCControlRenderer::SmoothResize and CDrawingmanager::DrawRotated.<\/p>\n<h2>Methods where visibility was changed<\/h2>\n<p><span style=\"color:rgb(51,102,255);\">SELECT METHODS WHERE<\/span> VisibilityWasChanged<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.cppdepend.com\/img\/mfccomparison\/img17.png\" class=\"bordered\" alt=\"\"><\/p>\n<p>Almost the visibility of all CMFCRibbonTab methods is changed from private to public.<\/p>\n<p>But when i checked the code source the only modification in the class declaration is the adding of DECLARE_DYNAMIC(CMFCRibbonTab) , this macro include &#8220;public:&#8221; , so i wonder if this visibility changes is only a side effect of adding this macro.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Visual C++ 2010: MFC new features 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&#8217;s new in MFC 10? To answer to this question i tried to &hellip; <a href=\"https:\/\/codergears.com\/Blog\/?p=78\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Comparing MFC10 to MFC9&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78"}],"version-history":[{"count":2,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":80,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions\/80"}],"wp:attachment":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}