PRB: Toolbar removed from Active Document in a frame in IE4 (177239)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 4.0
  • The Microsoft Foundation Classes (MFC)

This article was previously published under Q177239

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);
   }
				

Modification Type:MajorLast Reviewed:6/18/2001
Keywords:kbprb KB177239