I am currently trying to subclass an Edit Control, in particular the subject of en Email in the Outlook Client. This control is of class RichEdit20WPT.
I get a wndProc by using the following WINAPI methods.
<DllImport("ComCtl32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function SetWindowSubclass(hWnd As IntPtr, newProc As Win32SubClassProc, uIdSubclass As IntPtr, dwRefData As IntPtr) As Integer
End Function
<DllImport("comctl32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Public Shared Function DefSubclassProc(ByVal hWnd As IntPtr, ByVal uMsg As IntPtr, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer
End Function
Public Delegate Function Win32SubClassProc(hWnd As IntPtr, Msg As IntPtr, wParam As IntPtr, lParam As IntPtr, uIdSubclass As IntPtr, dwRefData As IntPtr) As Integer
And would then have a wndProc like this;
Private WM_CONTEXTMENU As IntPtr = &H7B
Private Function SubClassProc(hWnd As IntPtr, Msg As IntPtr, wParam As IntPtr, lParam As IntPtr, uIdSubclass As IntPtr, dwRefData As IntPtr) As Integer
Select Case Msg
Case WM_DESTROY
Case WM_NCDESTROY
Case WM_LBUTTONDOWN
Case WM_CONTEXTMENU 'NEVER HAPPENS
Case WM_RBUTTONDOWN
End Select
Return DefSubclassProc(hWnd, Msg, wParam, lParam)
End Function
I get the L and R button down and up messages but no WM_CONTEXTMENU. My current intention is to add a menu item to the context menu so as an alternative I am using the WM_RBUTTONDOWN message.
Is this control special and known to not show the WM_CONTEXTMENU message?
I also have a challenge to find the messages that occur after choosing something on the context menu. My understanding is that the messages of the menu item clicked in the context menu are given to the parent which in this case is this RichEdit20WPT window. Is this correct? Note I am not making my own context menu I am appending to the existing one so I am not changing the owner of the context menu or anything like that.