FIX: DocObject Server with OCX in View Causes ASSERT in IE (190964)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q190964 SYMPTOMS
DocObject server with ActiveX controls in its view will assert (WINMDI.CPP
Line 341) when navigating pages in Internet Explorer version 4.01.
CAUSE
The SendMessage() with WM_MDIGETACTIVE in the code of
CMDIFrameWnd::MDIGetActive() function is returning an invalid window handle
(HWND).
RESOLUTION
To correct the problem, we must check the validity of the HWND returned by
processing WM_MDIGETACTIVE message, and set the HWND to NULL if it's not
valid. Below are the listed steps:
- Subclass the MDI client to intercept the WM_MDIGETACTIVE message.
For additional information that shows how to subclass the MDICLIENT window,
please see the following article in the Microsoft Knowledge Base:
129471 How to SubClass the MDIClient by Using MFC
- Handle the WM_MDIGETACTIVE message in the MDI client as follow:
// CMDIClientWnd is the MDI client window. OnMdiGetActivate() is
// the message handler for WM_MDIGETACTIVE.
BEGIN_MESSAGE_MAP(CMDIClientWnd, CWnd)
//{{AFX_MSG_MAP(CMDIClientWnd)
//}}AFX_MSG_MAP
ON_MESSAGE(WM_MDIGETACTIVE, OnMdiGetActivate)
END_MESSAGE_MAP()
// Validate the HWND returned from processing the WM_MDIGETACTIVE
// in the default window procedure. Returns NULL if an invalid MDI
// child window is found.
afx_msg LRESULT CMDIClientWnd::OnMdiGetActivate(WPARAM, LPARAM)
{
LRESULT rvalue = Default();
if (rvalue)
{
CMDIChildWnd* pWnd =
(CMDIChildWnd*)CWnd::FromHandle((HWND) rvalue);
if (pWnd &&
pWnd->IsKindOf(RUNTIME_CLASS(CMDIChildWnd)) == 0)
{
return NULL;
}
}
return rvalue;
}
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
This problem was corrected in Microsoft Visual C++ .NET.
REFERENCES
For additional information, please see the following article in the
Microsoft Knowledge Base:
129471 How to SubClass the MDIClient by Using MFC
Modification Type: | Major | Last Reviewed: | 12/10/2003 |
---|
Keywords: | kbBug kbfix kbNoUpdate KB190964 kbAudDeveloper |
---|
|