PRB: Toolbar removed from Active Document in a frame in IE4

ID: Q177239


The information in this article applies to:
  • Microsoft Internet Explorer (Programming) version 4.0
  • The Microsoft Foundation Classes (MFC), included with:
    • Microsoft Visual Studio 97


SYMPTOMS

When an MFC Active Document is inserted into a frame in Internet Explorer 4.0, the toolbar is removed from the Active Document when focus is set to another frame. Even when focus is set back to the frame that contains the Active Document, the toolbar does not reappear.


CAUSE

Active Documents are UI Deactivated when focus is set to another frame, but MFC-based Active Documents are not automatically UI Activated when focus is set back to the frame containing the document.


STATUS

This behavior is by design.


MORE INFORMATION

In order for the toolbar to reappear when the focus is set to the frame containing the Active Document, you must override CWnd::OnMouseActivate() in your CView-derived class and call COleServerDoc::ActivateInPlace().

Here is the code that is needed to override CWnd::OnMouseActivate().

MyView.h


   afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest,
                               UINT message); 

MyView.cpp


   BEGIN_MESSAGE_MAP(CMyView, CView)
      ...
      ON_WM_MOUSEACTIVATE()
      ...
   END_MESSAGE_MAP()

   int CMyView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest,
                                UINT message)
   {
      COleServerDoc* pDoc = (COleServerDoc*)GetDocument();
      pDoc->ActivateInPlace();

      return CView::OnMouseActivate(pDesktopWnd, nHitTest, message);
   } 

Additional query words:

Keywords : kbcode kbole kbMFC kbVC AXSDKControls
Version : WINDOWS:4.0,97; winnt:
Platform : WINDOWS winnt
Issue type : kbprb


Last Reviewed: August 30, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.