PRB: Right-Clicking CRichEditView Doesn't Activate Frame (166213)



The information in this article applies to:

  • The Microsoft Foundation Classes (MFC), when used with:
    • Microsoft Visual C++, 32-bit Editions 4.0
    • Microsoft Visual C++, 32-bit Editions 4.0a
    • Microsoft Visual C++, 32-bit Editions 4.1
    • Microsoft Visual C++, 32-bit Enterprise Edition 4.2
    • Microsoft Visual C++, 32-bit Professional Edition 4.2
    • Microsoft Visual C++, 32-bit Enterprise Edition 4.2b
    • Microsoft Visual C++, 32-bit Professional Edition 4.2b
    • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
    • Microsoft Visual C++, 32-bit Professional Edition 5.0
    • 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 Q166213

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

Modification Type:MajorLast Reviewed:12/2/2003
Keywords:kbDocView kbMDI kbprb kbRichEdit KbUIDesign KB166213