📄 apicallbackprocs.bas
字号:
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_HOOKFOREGROUNDIDLEPROC = CallNextHookEx(Eventhandler.HookIdByType(WH_FOREGROUNDIDLE), Code, wParam, lParam)
End If
'\\ 1 - Pack the param array.....
ReDim Params(1 To 4) As Variant
Params(1) = Code
Params(2) = wParam
Params(3) = lParam
Params(4) = lMsgRet
'\\ 2 - Call the event firer....
If Not Eventhandler Is Nothing Then
Eventhandler.TriggerEvent HOOKPROC_FOREGROUNDIDLE, Params()
lMsgRet = Params(4)
End If
'\\ 3 - Pass this message on to the next hook proc in the chain (if any)
lret = CallNextHookEx(Eventhandler.HookIdByType(WH_FOREGROUNDIDLE), Code, wParam, lParam)
If Err.LastDllError > 0 Then
Call ReportError(Err.LastDllError, "VB_HOOKFOREGROUNDIDLEPROC ", GetLastSystemError)
End If
'\\ If the message isn't cancelled, return the next hook's message...
If Not (lMsgRet) Then
'\\ Return value to calling code....
VB_HOOKFOREGROUNDIDLEPROC = lret
End If
End Function
'\\ [VB_HOOKGETMESSAGEPROC]----------------------------------------------------------------------------------------------
'\\ 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_HOOKGETMESSAGEPROC(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_HOOKGETMESSAGEPROC = CallNextHookEx(Eventhandler.HookIdByType(WH_GETMESSAGE), Code, wParam, lParam)
End If
'\\ 1 - Pack the param array.....
ReDim Params(1 To 4) As Variant
Params(1) = Code
Params(2) = wParam
Params(3) = lParam
Params(4) = lMsgRet
'\\ 2 - Call the event firer....
If Not Eventhandler Is Nothing Then
Eventhandler.TriggerEvent HOOKPROC_GETMESSAGE, Params()
lMsgRet = Params(4)
End If
'\\ 3 - Pass this message on to the next hook proc in the chain (if any)
lret = CallNextHookEx(Eventhandler.HookIdByType(WH_GETMESSAGE), Code, wParam, lParam)
If Err.LastDllError > 0 Then
Call ReportError(Err.LastDllError, "VB_HOOKGETMESSAGEPROC ", GetLastSystemError)
End If
'\\ If the message isn't cancelled, return the next hook's message...
If Not (lMsgRet) Then
'\\ Return value to calling code....
VB_HOOKGETMESSAGEPROC = lret
End If
End Function
'\\ [VB_HOOKJOURNALPLAYBACKPROC]----------------------------------------------------------------------------------------------
'\\ 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_HOOKJOURNALPLAYBACKPROC(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_HOOKJOURNALPLAYBACKPROC = CallNextHookEx(Eventhandler.HookIdByType(WH_JOURNALPLAYBACK), Code, wParam, lParam)
End If
'\\ 1 - Pack the param array.....
ReDim Params(1 To 4) As Variant
Params(1) = Code
Params(2) = wParam
Params(3) = lParam
Params(4) = lMsgRet
'\\ 2 - Call the event firer....
If Not Eventhandler Is Nothing Then
Eventhandler.TriggerEvent HOOKPROC_JOURNALPLAYBACK, Params()
lMsgRet = Params(4)
End If
'\\ 3 - Pass this message on to the next hook proc in the chain (if any)
lret = CallNextHookEx(Eventhandler.HookIdByType(WH_JOURNALPLAYBACK), Code, wParam, lParam)
If Err.LastDllError > 0 Then
Call ReportError(Err.LastDllError, "VB_HOOKJOURNALPLAYBACKPROC ", GetLastSystemError)
End If
'\\ If the message isn't cancelled, return the next hook's message...
If Not (lMsgRet) Then
'\\ Return value to calling code....
VB_HOOKJOURNALPLAYBACKPROC = lret
End If
End Function
'\\ [VB_HOOKJOURNALRECORDPROC]----------------------------------------------------------------------------------------------
'\\ 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_HOOKJOURNALRECORDPROC(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_HOOKJOURNALRECORDPROC = CallNextHookEx(Eventhandler.HookIdByType(WH_JOURNALRECORD), Code, wParam, lParam)
End If
'\\ 1 - Pack the param array.....
ReDim Params(1 To 4) As Variant
Params(1) = Code
Params(2) = wParam
Params(3) = lParam
Params(4) = lMsgRet
'\\ 2 - Call the event firer....
If Not Eventhandler Is Nothing Then
Eventhandler.TriggerEvent HOOKPROC_JOURNALRECORD, Params()
lMsgRet = Params(4)
End If
'\\ 3 - Pass this message on to the next hook proc in the chain (if any)
lret = CallNextHookEx(Eventhandler.HookIdByType(WH_JOURNALRECORD), Code, wParam, lParam)
If Err.LastDllError > 0 Then
Call ReportError(Err.LastDllError, "VB_HOOKJOURNALRECORDPROC ", GetLastSystemError)
End If
'\\ If the message isn't cancelled, return the next hook's message...
If Not (lMsgRet) Then
'\\ Return value to calling code....
VB_HOOKJOURNALRECORDPROC = lret
End If
End Function
'\\ [VB_HOOKMOUSEPROC]----------------------------------------------------------------------------------------------
'\\ 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_HOOKMOUSEPROC(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_HOOKMOUSEPROC = CallNextHookEx(Eventhandler.HookIdByType(WH_MOUSE), Code, wParam, lParam)
End If
'\\ 1 - Pack the param array.....
ReDim Params(1 To 4) As Variant
Params(1) = Code
Params(2) = wParam
Params(3) = lParam
Params(4) = lMsgRet
'\\ 2 - Call the event firer....
If Not Eventhandler Is Nothing Then
Eventhandler.TriggerEvent HOOKPROC_MOUSE, Params()
lMsgRet = Params(4)
End If
'\\ 3 - Pass this message on to the next hook proc in the chain (if any)
lret = CallNextHookEx(Eventhandler.HookIdByType(WH_MOUSE), Code, wParam, lParam)
If Err.LastDllError > 0 Then
Call ReportError(Err.LastDllError, "VB_HOOKMOUSEPROC ", GetLastSystemError)
End If
'\\ If the message isn't cancelled, return the next hook's message...
If Not (lMsgRet) Then
'\\ Return value to calling code....
VB_HOOKMOUSEPROC = lret
End If
End Function
'\\ [VB_HOOKLOWLEVELMOUSEPROC]----------------------------------------------------------------------------------------------
'\\ 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_HOOKLOWLEVELMOUSEPROC(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_HOOKLOWLEVELMOUSEPROC = CallNextHookEx(Eventhandler.HookIdByType(WH_MOUSE_LL), Code, wParam, lParam)
End If
'\\ 1 - Pack the param array.....
ReDim Params(1 To 4) As Variant
Params(1) = Code
Params(2) = wParam
Params(3) = lParam
Params(4) = lMsgRet
'\\ 2 - Call the event firer....
If Not Eventhandler Is Nothing Then
Eventhandler.TriggerEvent HOOKPROC_MOUSE_LL, Params()
lMsgRet = Params(4)
End If
'\\ 3 - Pass this message on to the next hook proc in the chain (if any)
lret = CallNextHookEx(Eventhandler.HookIdByType(WH_MOUSE_LL), Code, wParam, lParam)
If Err.LastDllError > 0 Then
Call ReportError(Err.LastDllError, "VB_HOOKLOWLEVELMOUSEPROC ", GetLastSystemError)
End If
'\\ If the message isn't cancelled, return the next hook's message...
If Not (lMsgRet) Then
'\\ Return value to calling code....
VB_HOOKLOWLEVELMOUSEPROC = lret
End If
End Function
'\\ [VB_HOOKMESSAGEFILTERPROC]----------------------------------------------------------------------------------------------
'\\ 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_HOOKMESSAGEFILTERPROC(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_HOOKMESSAGEFILTERPROC = CallNextHookEx(Eventhandler.HookIdByType(WH_MSGFILTER), Code, wParam, lParam)
End If
'\\ 1 - Pack the param array.....
ReDim Params(1 To 4) As Variant
Params(1) = Code
Params(2) = wParam
Params(3) = lParam
Params(4) = lMsgRet
'\\ 2 - Call the event firer....
If Not Eventhandler Is Nothing Then
Eventhandler.TriggerEvent HOOKPROC_MESSAGEFILTER, Params()
lMsgRet = Params(4)
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -