KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q166213: PRB: Right-Clicking CRichEditView Doesn’t Activate Frame

Article: Q166213
Product(s): Microsoft C Compiler
Version(s): winnt:4.0,4.0a,4.1,4.2,4.2b,5.0,6.0
Operating System(s): 
Keyword(s): kbDocView kbMDI kbMFC kbRichEdit KbUIDesign kbVC kbVC400 kbVC410 kbVC420 kbVC500 kbVC60
Last Modified: 04-AUG-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- The Microsoft Foundation Classes (MFC), used with:
   - Microsoft Visual C++, 32-bit Editions, versions 4.0, 4.0a, 4.1 
   - Microsoft Visual C++, 32-bit Enterprise Edition, version 4.2 
   - Microsoft Visual C++, 32-bit Professional Edition, version 4.2 
   - Microsoft Visual C++, 32-bit Enterprise Edition, version 4.2b 
   - Microsoft Visual C++, 32-bit Professional Edition, version 4.2b 
   - Microsoft Visual C++, 32-bit Enterprise Edition, version 5.0 
   - Microsoft Visual C++, 32-bit Professional Edition, version 5.0 
   - Microsoft Visual C++, 32-bit Enterprise Edition, version 6.0 
   - Microsoft Visual C++, 32-bit Professional Edition, version 6.0 
   - Microsoft Visual C++, 32-bit Learning Edition, version 6.0 
-------------------------------------------------------------------------------

SYMPTOMS
========

If you have a CRichEditView or CRichEditCtrl on a CMDIChildWnd and you
right-click the richedit control, focus is set to the richedit control but the
frame is not activated.

CAUSE
=====

The richedit control is not sending a WM_MOUSEACTIVATE message to its parent.

RESOLUTION
==========

Override OnMouseActivate() in a CRichEditView or CRichEditCtrl and pass this
message on to the parent. The MORE INFORMATION section below has code that
illustrates this.

STATUS
======

Microsoft has confirmed this to be a bug in the Microsoft products listed at the
beginning of this article. We are researching this bug and will post new
information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION
================

Sample Code
-----------

     /* Compile options needed: default
     */ 

     int CTestView::OnMouseActivate(CWnd* pDesktopWnd,
        UINT nHitTest, UINT message)
     {
        const MSG* pMsg = GetCurrentMessage();

        GetParent()->SendMessage(WM_MOUSEACTIVATE,
           pMsg->wParam, pMsg->lParam);

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

Additional query words:

======================================================================
Keywords          : kbDocView kbMDI kbMFC kbRichEdit KbUIDesign kbVC kbVC400 kbVC410 kbVC420 kbVC500 kbVC600 kbVS600 kbWndwMsg kbGrpDSMFCATL 
Technology        : kbAudDeveloper kbMFC
Version           : winnt:4.0,4.0a,4.1,4.2,4.2b,5.0,6.0
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.

Copyright Microsoft Corporation 1986-2002.