FIX: An MFC application that uses the COleDocIPFrameWndEx class for document embedding fails

Symptoms

Consider the following scenario:

  • You use the Microsoft Foundation Class (MFC) Application Wizard in Microsoft Visual Studio 2010 Service Pack 1 (SP1) to create an MFC application.
  • The MFC application is a multiple-document interface (MDI) application that acts as an Object Linking and Embedding (OLE) client and as an OLE server.
  • You try to use a client application, for example Microsoft Excel, to embed an object for which this new application is the OLE server.

In this scenario, an access violation occurs and the embed operation fails. Additionally, if the MFC application is built with the _DEBUG flag, an assertion failure is reported in the following code:

COleCntrFrameWndEx* COleDocIPFrameWndEx::GetContainerFrameWindow()
{
      COleCntrFrameWndEx* pNewFrame = DYNAMIC_DOWNCAST(COleCntrFrameWndEx, m_pMainFrame); 
       ASSERT_VALID(pNewFrame);
       return pNewFrame;
}

      

Cause

This issue occurs because of is a bug in the MFC library. When this issue occurs, an object of the COleCntrFrameWnd base class is incorrectly created instead of the derived COleCntrFrameWndEx class. Therefore, the DYNAMIC_DOWNCAST method fails and the issue that is described in the "Symptoms" section occurs.

Resolution

Apply the following hotfix to resolve this issue.
Note This hotfix applies to the Microsoft Visual C++ 2010 SP1 Redistributable Package. To obtain the hotfix for Microsoft Visual Studio 2010 SP1, click the following article number to view the article in the Microsoft Knowledge Base:

2627201 [Visual Studio fix]An MFC application that uses the COleDocIPFrameWndEx class for document embedding fails

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft website:

http:⁠//support.microsoft.com/contactus/?ws=support Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

To apply this hotfix, you must have Microsoft Visual C++ 2010 SP1 Redistributable Package installed.

Restart requirement

You may have to restart the computer after you install this hotfix if the affected files are being used.

Hotfix replacement information

 This hotfix does not replace any other previously released hotfix.

File Information

The global version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

For all supported x86-based versions of Microsoft Visual C++ 2010 SP1 Redistributable Package

File name File version File size Date Time Platform
Atl100.dll 10.0.40219.363 139,016 16-Nov-2011 18:23 x86
Mfc100.dll 10.0.40219.363 4,398,344 16-Nov-2011 18:23 x86
Mfc100chs.dll 10.0.40219.363 37,136 16-Nov-2011 18:23 x86
Mfc100cht.dll 10.0.40219.363 37,136 16-Nov-2011 18:23 x86
Mfc100deu.dll 10.0.40219.363 65,296 16-Nov-2011 18:23 x86
Mfc100enu.dll 10.0.40219.363 56,080 16-Nov-2011 18:23 x86
Mfc100esn.dll 10.0.40219.363 64,784 16-Nov-2011 18:23 x86
Mfc100fra.dll 10.0.40219.363 65,296 16-Nov-2011 18:23 x86
Mfc100ita.dll 10.0.40219.363 63,248 16-Nov-2011 18:23 x86
Mfc100jpn.dll 10.0.40219.363 44,816 16-Nov-2011 18:23 x86
Mfc100kor.dll 10.0.40219.363 44,304 16-Nov-2011 18:23 x86
Mfc100rus.dll 10.0.40219.363 61,712 16-Nov-2011 18:23 x86
Mfc100u.dll 10.0.40219.363 4,423,944 16-Nov-2011 18:23 x86
Mfcm100.dll 10.0.40219.363 82,696 16-Nov-2011 18:23 x86
Mfcm100u.dll 10.0.40219.363 82,704 16-Nov-2011 18:23 x86
Msvcp100.dll 10.0.40219.363 422,160 16-Nov-2011 18:23 x86
Msvcr100_clr0400.dll 10.0.40219.363 774,928 16-Nov-2011 18:23 x86
Vcomp100.dll 10.0.40219.363 51,984 16-Nov-2011 18:23 x86

For all supported x64-based versions of Microsoft Visual C++ 2010 SP1 Redistributable Package

File name File version File size Date Time Platform
Atl100.dll 10.0.40219.363 159,496 16-Nov-2011 17:41 x64
Mfc100.dll 10.0.40219.363 5,575,944 16-Nov-2011 17:41 x64
Mfc100chs.dll 10.0.40219.363 37,136 16-Nov-2011 17:41 x64
Mfc100cht.dll 10.0.40219.363 37,136 16-Nov-2011 17:41 x64
Mfc100deu.dll 10.0.40219.363 65,296 16-Nov-2011 17:41 x64
Mfc100enu.dll 10.0.40219.363 56,080 16-Nov-2011 17:41 x64
Mfc100esn.dll 10.0.40219.363 64,784 16-Nov-2011 17:41 x64
Mfc100fra.dll 10.0.40219.363 65,296 16-Nov-2011 17:41 x64
Mfc100ita.dll 10.0.40219.363 63,248 16-Nov-2011 17:41 x64
Mfc100jpn.dll 10.0.40219.363 44,816 16-Nov-2011 17:41 x64
Mfc100kor.dll 10.0.40219.363 44,304 16-Nov-2011 17:41 x64
Mfc100rus.dll 10.0.40219.363 61,712 16-Nov-2011 17:41 x64
Mfc100u.dll 10.0.40219.363 5,603,080 16-Nov-2011 17:41 x64
Mfcm100.dll 10.0.40219.363 93,960 16-Nov-2011 17:41 x64
Mfcm100u.dll 10.0.40219.363 93,968 16-Nov-2011 17:41 x64
Msvcp100.dll 10.0.40219.363 609,040 16-Nov-2011 17:41 x64
Msvcr100_clr0400.dll 10.0.40219.363 830,224 16-Nov-2011 17:41 x64
Vcomp100.dll 10.0.40219.363 58,128 16-Nov-2011 17:41 x64

For all supported IA-64–based versions of Visual C++ 2010 SP1 Redistributable Package

File name File version File size Date Time Platform
Atl100.dll 10.0.40219.363 386,312 16-Nov-2011 18:00 IA-64
Msvcp100.dll 10.0.40219.363 967,440 16-Nov-2011 18:00 IA-64
Msvcr100_clr0400.dll 10.0.40219.363 1,500,432 16-Nov-2011 18:00 IA-64
Vcomp100.dll 10.0.40219.363 144,144 16-Nov-2011 18:00 IA-64

              

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

More Information

For more information about how to create an MFC application, visit the following MSDN website:

How to create an MFC Application