ATL and MFC changes and fixes in Visual Studio 2013

ATL and MFC changes and fixes in Visual Studio 2013

Rate This
  • Comments 27

Hello, I’m Pat Brenner, a developer on the Visual C++ Libraries team.  In this blog post I would like to share with you the changes that we’ve made in ATL and MFC for Visual Studio 2013.

One of the major changes we made was to eliminate the ATL DLL altogether.  All ATL code is now static, either in the header files or in the ATL static library.  We also reduced the amount of code in the ATL static library substantially, so there are no longer multiple static libraries for debug/release mode or Unicode/ANSI character set.  There is only one ATL static library that is common to all configurations. 

The changes to ATL also included the elimination of the ATL/MFC Trace Tool and the simplification of the tracing mechanism.  The TRACE macros now essentially boil down to OutputDebugString, and there is no external controller of tracing level (like the trace tool provided)—the tracing level is set in the application itself.  This does cause source-breaking changes in some uses of the ATL::CTraceCategory class, which will require changes in source code when migrating to Visual Studio 2013.

The major change we made in MFC was the deprecation of MBCS support (see more information in this separate blog post).

In addition, we fixed about 105 bugs in MFC and about 60 bugs in ATL.  About one-fourth of these bugs (in both libraries) were reported by customers.

Though I cannot provide a complete list of the bugs in our internal bug database, here is a list of the bugs that were reported by customers through our Connect site that have been fixed in ATL and MFC for Visual Studio 2013 RTM. Click on any Connect bug number to see more information about that bug.  Note that most of these bugs were fixed for the Preview release as well.

Connect #

Bug Title

710163

atlbase.h disables no longer existing C4217 warning

714790

Useless line of code in AtlSafeRealloc()

714791

AtlSafeRealloc() treats failures inconsistently and this leads to memory leaks

714840

CAtlServiceModuleT::LogEventEx() contains a useless check

714802

Suspicious error handling code in CAtlExeModuleT::StartMonitor()

742895

CComApartment::Apartment() leaks objects on edge cases

736213

ATL::CComSafeArray::operator[] ambiguity

764800

wrong/missing sal annotations on consumer oledb macros

750369

Breaking change in how the ATL OLE DB CCommand::Execute method behaves

774871

Certification fails for Windows Store App with ATL-based library

785396

Uninstalling VS2012 Update 2 and repair of VS results in ATL files missing.

789669

ATL CRBMap::Lookup code analysis markup issue

790309

VC++11 regression: error C2338: db_command using v110 toolset

745790

Static MFC executables produced by Visual Studio 2012 RC are huge

750838

MFC loads DLLs using LoadLibraryEx with flag only supported on Windows8

757588

CMFCRibbonBar::AddToTabs removes a wrong button from the m_arButtons array

763947

EndDialog in OnInitDialog reopen Dialog

763517

IMPLEMENT_DYNAMIC produces compile error for statically linked MFC projects

768378

CMFCTabCtrl bug

769093

MFC Edit Browse box not showing browse button.

772859

Calling EndDialog() within OnInitDialog() causes the dialog to be displayed twice.

750859

Visual Studio 11 Beta - bug running .exe in XP service pack 3

763474

Errors detected in the Visual C++ 2012 libraries

760371

LocalFree called twice in CDatabase (MFC 11)

710858

MFC OLE-Server doesn't seem to support the new style MFC  Toolbars

773463

Attempting to use DrawStatusText after including afxwin.h  results in link error

768257

Probems with CRecordset::GetFieldValue(short nIndex,  CDBVariant& varValue) in VS2012

772549

x64 MFC Macro Bug - ON_WM_POWERBROADCAST() /   CWnd::OnPowerBroadcast

773448

CHttpFile::QueryInfo() returns "corrupted" CStrings with invalid lengths.

778201

Missing MFC Functions

777604

CWnd::GetScrollLimit returns 1 if scrolling is deactivated

781179

CMFCPopupMenu crash when you click outside while submenu still open

781379

CMFCShellTreeCtrl fails to handle some UNC pathnames correctly

781257

MFC - CMFCTabCtrl - when style is STYLE_3D_VS2005 and SetActiveTabBoldFont() is set

789970

Unpaired pragma warning push/pop in afxwin.h in Release build

790246

MFC: bad hard typecast in CMFCToolBarMenuButton::CompareWith

790975

HTTP_QUERY_FLAG_REQUEST_HEADERS on CHttpFile::QueryInfo()   asserts wrongly

792003

CMFCShellListCtrl::OnContextMenu 'Delete' context menu handler does not work

 

I hope you find this information useful.  Please let us know if you have any questions.

Pat Brenner, Visual C++ Libraries Development Team

  • Just as expected, nothing new except bug fixes.

  • Just as it should be - nothing new except bug fixes.

  • Why is it possible to certify an ATL based DLL to be used in a Windows Store App, but not an MFC based DLL? This is really annoying and unproductive!! I can understand that the MFC-UI-API can't be used, but why is it forbidden in the certification kit to add a simple service layer MFC DLL which does not use the UI at all??

    Greetings...

  • More fixes for ancient technologies.  What we need are modern native technologies for real (desktop) applications.

  • rvalue support for CString ?

  • New native technologies are good, but bug fixes are essential.

  • Heels Pat, I'm particularly interested to know more about bug fixes to the BCGSoft parts of MFC. The tabbed documents and ribbon classes where rather buggy in VS2012, have there been any fixes in this area?

  • Good to see the fixes and depreciation of unused features.

  • I wish we could have something like a winrt-like library for desktop application one day ('come one, you know that isn't so difficult to enable winrt libraries for desktop!)

  • Still no support for resizable dialogs? :(

  • Move semantics support for CString would indeed be very welcome.

  • CString::Format() is not type safe. We have developed our own formatter for SQL tfb::db::sprintf(). Once VC++ 2013 is released, I will swap in the variadic template version I have ready to go. I will also look at a non-SQL specific type safe sprintf at some point. It's time to leave CString behind.

  • Any chance the ATL headers will be made clean for code analysis? We see a few warnings from atlcom.h:

    c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlcom.h(5032): warning C28196: The requirement that '*_Param_(3)!=0' is not satisfied. (The expression does not evaluate to true.): Lines: 5037

    c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlcom.h(4688): warning C6101: Returning uninitialized memory '*pvarResult'.  A successful path through the function does not set the named _Out_ parameter. : Lines: 4688, 4698, 4699, 4700, 4710, 4711, 4688

    c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlcom.h(4040): warning C6388: '*pp' might not be '0':  this does not adhere to the specification for the function 'ATL::CComCoClass<CMenuItems,&CLSID_MenuItems>::CreateInstance'. : Lines: 4042

    c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlcom.h(5510): warning C28204: 'Next' : Only one of this override and the one at c:\program files (x86)\windows kits\8.0\include\um\oaidl.h(2363) are annotated for _Param_(2): both or neither must be annotated.

  • high dpi bug fix? such as CMFCPropertySheet. I run 150% dpi on surface pro

  • Please fix the GetGValue macro in WinGDI.h that still causes a run-time smaller type check failure.

    Action: Edit WinGDI.h and replace WORD cast with LOWORD macro, as follows:

    #define GetGValue(rgb)      (LOBYTE((LOWORD(rgb)) >> 8))

    The same issue occurs for GetA, GetR, GetG, GetB of GdiPlusColor.h, so you have to replace BYTE cast with LOBYTE macro.

Page 1 of 2 (27 items) 12