ublic Const WM_RBUTTONUP As Long = &H205
Public Const WM_MOUSEMOVE As Long = &H200
Public Const WM_MOUSEWHEEL As Long = &H20A
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const MK_RBUTTON As Long = &H2
Public Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Public Const VK_LBUTTON As Long = &H1
Public Const VK_RBUTTON As Long = &H2
Public Const VK_MBUTTON As Long = &H4
Dim mPt As POINTAPI
Const ptGap As Single = 5 * 5
Dim preDir As Long
Dim mouseEventDsp As String
Dim eventLength As Long
''######### mouse hook #############
Public Sub InstallMouseHook()
hMouseHook = SetWindowsHookEx(WH_MOUSE, AddressOf MouseHookProc, _
App.hInstance, App.ThreadID)
End Sub
Public Function MouseHookProc(ByVal iCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim Cancel As Boolean
Cancel = False
On Error GoTo due
Dim i&
Dim nMouseInfo As MOUSEHOOKSTRUCT
Dim tHWindowFromPoint As Long
Dim tpt As POINTAPI
If iCode = HC_ACTION Then
CopyMemory nMouseInfo, ByVal lParam, Len(nMouseInfo)
tpt = nMouseInfo.pt
ScreenToClient nMouseInfo.hwnd, tpt
''Debug.Print tpt.X, tpt.Y
If nMouseInfo.wHitTestCode = 1 Then
Select Case wParam
Case WM_RBUTTONDOWN
mPt = nMouseInfo.pt
preDir = -1
mouseEventDsp = ""
Cancel = True
Case WM_RBUTTONUP
Debug.Print mouseEventDsp
Cancel = True
Case WM_MOUSEMOVE
If vkPress(VK_RBUTTON) Then
Call GetMouseEvent(nMouseInfo.pt)
&nbs