I'm developing a VSTO Word addin. Is it possible for vsto add-in to detect if user click outside of document region.
Example like in the image below: Detect if I click anywhere inside the black box (ribbon area and the bottom area)
No need for me to know what control is being clicked... as long as that click happen inside those two black boxes.
Any way for me to that that? Thanks.
UPDATE:
Private Function MouseHookCallback(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
If nCode = 0 Then
Dim mouseHookStruct = CType(Marshal.PtrToStructure(lParam, GetType(SafeNativeMethods.MouseHookStructEx)), SafeNativeMethods.MouseHookStructEx)
Dim message = CType(wParam, SafeNativeMethods.WindowMessages)
Debug.WriteLine("{0} event detected at position {1} - {2}", message, mouseHookStruct.pt.X, mouseHookStruct.pt.Y)
If message = WindowMessages.WM_LBUTTONDOWN Or message = WindowMessages.WM_MBUTTONDOWN Or message = WindowMessages.WM_RBUTTONDOWN Or _
message = WindowMessages.WM_MOUSEHWHEEL Or message = WindowMessages.WM_MOUSEWHEEL Then
'do something here
End If
If message = WindowMessages.WM_MOUSEMOVE Then
Debug.WriteLine("mouse move!!!!!!!!!!!!!!!!!!a with ncode=> " & nCode)
End If
End If
Return SafeNativeMethods.CallNextHookEx(_hookIdKeyboard, nCode, wParam, lParam)
End Function