Here it is:
[tt]
Option Explicit
Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpDest As Any, lpSource As Any, ByVal cBytes As Long)
Public Const WH_JOURNALRECORD = 0
Public Const WH_GETMESSAGE = 3
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_CANCELJOURNAL = &H4B
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type MSG
hWnd As Long
Message As Long
wParam As Long
lParam As Long
Time As Long
pt As POINTAPI
End Type
Private Type EVENTMSG
Message As Long
lParamLow As Long
lParamHigh As Long
Time As Long
hWnd As Long
End Type
Public m_hJournalRecord As Long, m_hGetMsg As Long
Public Function JournalRecordProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If nCode < 0 Then
JournalRecordProc = CallNextHookEx(m_hJournalRecord, nCode, wParam, lParam)
Else
Call ProcessMessage(lParam)
Call CallNextHookEx(m_hJournalRecord, nCode, wParam, lParam)
End If
End Function
Public Function GetMsgProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If nCode < 0 Then
GetMsgProc = CallNextHookEx(m_hGetMsg, nCode, wParam, lParam)
Else
Dim Message As MSG
Call CopyMemory(Message, ByVal lParam, Len(Message))
Select Case Message.Message
Case WM_CANCELJOURNAL
If wParam = 1 Then Call ProcessMessage(WM_CANCELJOURNAL)
End Select
Call CallNextHookEx(m_hGetMsg, nCode, wParam, ByVal lParam)
End If
End Function
Private Sub ProcessMessage(ByVal lParam As Long)
Dim Message As EVENTMSG
If lParam = WM_CANCELJOURNAL Then
m_hJournalRecord = SetWindowsHookEx(WH_JOURNALRECORD, AddressOf JournalRecordProc, App.hInstance, 0)
Exit Sub
End If
Call CopyMemory(Message, ByVal lParam, Len(Message))
Select Case Message.Message
Case WM_LBUTTONDOWN
'etc
End Select
End Sub
[/tt]