Library Implementation Changes

CAsyncSocket

The SendTo member function correctly returns errors. In previous versions of MFC, SendTo returned FALSE for some errors. The function now returns a proper WinSock error code in all circumstances.

Collection Classes

FindIndex returns NULL for negative indexes.

List-based collections with a FindIndex member will return NULL if the index passed to the function is negative. In previous releases, a negative index caused the program to stop responding or an access violation.

CControlBar

  • New SetBorders member function

    The SetBorders member is a public accessor that allows other classes to set the bar’s borders.

  • New DrawGripper member function

    The DrawGripper member function draws a "gripper," that is a user-interface clue on command bars that are movable or resizable. CalcInsideRect adjusts for the correct sizing of a bar that has a gripper.

  • New assertion behavior for m_dwStyle

    The CControlBar class will assert that the m_dwStyle member only contains MFC-specific bits—masked by CBRS_ALL. This assertion will fire if user code incorrectly sets window-style bits.

CDaoDatabase

Some recent releases of MFC had problems running correctly on machines that weren’t updated to DAO 3.5. Those problems have been resolved, but it is still advisable to upgrade to DAO 3.5, due to performance and stability improvements.

CDaoRecordset

  • Newly const members

    The IsBOF and IsEOF member functions are now const.

  • Unicode version of DFX_Text fixed

    The DFX_Text function would not allocate enough space when binding Unicode strings, and this problem has been fixed.

CDC

In previous versions of MFC, CDC member functions would sometimes return unpredictable values for extreme failure conditions. These functions have been cleaned up and now return the correct error code.

CInternetFile

ReadString doesn’t truncate

In some circumstances, the ReadString member function would truncate data read from the connection. This bug has been fixed.

CInternetSession

  • Aggressive buffer validation

    All Internet-related functions in MFC more aggressively assert on the validity of memory buffer pointer parameters.

  • No async support

    INTERNET_FLAG_ASYNC was never supported by MFC. The presence of this flag now causes debug builds of MFC to assert.

COleControl

  • Ignores fastBeginPaint

    The style bit fastBeginPaint is now ignored. ActiveX controls are always expected to erase their background in OnDraw, as they won’t receive WM_ERASEBKGND when rendering to a metafile DC.

  • Reflector window handles WM_SIZE

    The reflector window now handles WM_SIZE appropriately. Previously, the message was ignored.

COleDateTime

Member function rounding errors

Several rounding errors that existed in previous versions of the following member functions have been remedied: GetDays, GetHours, GetMinutes, GetSeconds, GetTotalDays, GetTotalHours, GetTotalMinutes, GetTotalSeconds.

COleDocument

Previous versions of MFC opened a storage with STGM_SHARE_EXCLUSIVE. MFC now uses the more appropriate STGM_SHARE_DENY_WRITE flag, which allows other applications to read the storage while it is opened by the document object.

CPropertyPage

  • Bogus assert fixed

    The creation of a property sheet with pages from a DIALOGEX resource would sometimes needlessly assert. The assertion has been corrected.

  • MapWizardResult return code

    The MapWizardResult member function would sometimes return an incorrect value. This problem has been corrected.

  • Property page activation could fail

    Some property page creations would result in a blank dialog box. This problem was fixed.

  • Incorrect return code from property page procedure

    MFC’s handler for EndDialog incorrectly returned IDCANCEL instead of PSBTN_CANCEL.

  • m_nModalResult incorrectly set

    A property page closed with the system menu or by the user pressing the close button might not correctly set the m_nModalResult member to IDCANCEL. This has been fixed.

CRecordset

The RFX_Int function incorrectly handled NULL values in previous versions of the library. This problem has been corrected.

CTabCtrl

SetItemState and GetItemState member functions have been added to support new functionality exposed by the revised COMCTL32.DLL.

CToolBar

The SetSizes function previously caused an assert when it wasn’t attached to a window, but now reacts by setting the member data of the object to reflect the size instead of moving the window’s position.

CScrollView

  • Mouse wheel asserts fixed

    A bug that caused a bogus assert when the mouse wheel was used to scroll a CScrollView has been fixed.

  • Mouse wheel page-mode scrolling fixed

    A bug that made page-by-page views scroll in the wrong direction has been fixed.

CView

The print preview bar has been restored to its rightful position—within the parent frame.

CWinThread

The MFC-supplied PreTranslateMessage member function is no longer responsible for canceling active tooltips. This code has been moved to CWnd::FilterToolTipMessage. This change was necessary to support the new tracking tooltip styles.

CWnd

The CenterWindow function has been fixed to work properly on multiple-monitor machines.