Is there something special about the wndProc messages for a RichEdit20WPT window?

徘徊边缘 提交于 2019-12-02 08:27:28
darbid

Thank you to all the comments which helped me to at least keep searching for answers or in this case messages. For anyone coming here and wanting to add to the context menu of an Outlook Menu.

First here are two good links which explain generally what to do. How to disable copy/paste commands in the Windows edit control context menu? Modify right-click context menu in standard controls Anyone reading them can assume for a standard edit control such as a text box on a windows form application that the messages will be sent.

For Outlook (At least 2007 / 2010) this is what I have found;

  1. The text box you need to find for both an Explorer and Inspector is RichEdit20WPT
  2. This window however does not get two of the key messages required. (a) it does not get WM_INITMENUPOPUP to know before the context menu is being shown and secondly (b) it does not get a message when you choose something in the context menu which is a WM_COMMAND in this case.
  3. Inorder to amend the context menu you need to subclass the subject text box's parent which is a window of class #32770.
  4. As the parent is subclassed there are a few challenges. To know when our target text box as had a right click from the #32770 window you need to look for the WM_SETCURSOR.

Something like this where the wParam will be the text box's Hwnd and the HiWord will be the mouse message;

Case NativeMethodsEX.WM_SETCURSOR
    If wParam = subjectHwnd Then
        Dim pMap As New NativeMethodsEX.LParamMap(lParam)
    If pMap.hiword = NativeMethodsEX.WM_RBUTTONUP Then
        rightClickOnSubject = True
    Else
        rightClickOnSubject = False
    End If
    End If

Then shortly after there will be this message

Case NativeMethodsEX.WM_INITMENUPOPUP
    If rightClickOnSubject Then
        'check here if you want to display something.
    End If

Once you know this, you can implement the ideas from the other forum answers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!