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

Last reviewed: November 24, 1997
Article 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);
   }

Keywords          : AXSDKControls MfcOLE kbcode
Technology        : kbInetDev kbole
Version           : WINDOWS:4.0,97; WINNT:
Platform          : WINDOWS winnt
Issue type        : kbprb


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 24, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.