'\\ [VB_HOOKCBTPROC]------------------------------------------------------
'\\ typedef LRESULT (CALLBACK* HOOKPROC)(int code, WPARAM wParam, LPARAM lParam);
'\\ code - type of hook,
'\\ Wparam, Lparam - message specific
'\\ lMsgRet = The message to pass to the calling code
'\\ --------------------------------------------------------------------------------
'\\ (c) 2001 - Merrion Computing. All rights to use, reproduce or publish this code reserved
'\\ Please check http://www.merrioncomputing.com for updates.
'\\ --------------------------------------------------------------------------------
Public Function VB_HOOKCBTPROC(ByVal Code As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
On Local Error Resume Next
Dim Params() As Variant
Dim lret As Long
Dim lMsgRet As Long
'\\ Note: If the code passed in is less than zero, it must be passed direct to the next hook proc
If Code < 0 Then
VB_HOOKCBTPROC = CallNextHookEx(Eventhandler.HookIdByType(WH_CBT), Code, wParam, lParam)
End If
'\\ Do whatever with the message here.......
'\\ Pass this message on to the next hook proc in the chain (if any)
lret = CallNextHookEx(Eventhandler.HookIdByType(WH_CBT), Code, wParam, lParam)
If Err.LastDllError > 0 Then
Debug.Print Err.LastDllError & " in VB_HOOKCBTPROC "
End If
'\\ If the message isn't cancelled, return the next hook's message...
If Not (lMsgRet) Then
'\\ Return value to calling code....
VB_HOOKCBTPROC = lret
End If
End Function