?? hookmod.bas
字號:
Attribute VB_Name = "hookmod"
Option Explicit
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" ( _
lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
Public Const GWL_WNDPROC = -4
'在這里寫下要攔下消息的常量定義
Public defWndProc As Long
Type rect
left As Long
top As Long
right As Long
bottom As Long
End Type
Public Sub Hook(hwnd As Long)
If defWndProc = 0 Then defWndProc = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Public Sub UnHook(hwnd As Long)
If defWndProc > 0 Then
Call SetWindowLong(hwnd, GWL_WNDPROC, defWndProc)
defWndProc = 0
End If
End Sub
Public Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = &H216 Then
Dim WPOS As rect
CopyMemory WPOS, ByVal lParam, Len(WPOS)
Form2.top = WPOS.top
Form2.left = WPOS.left + Form1.Width
End If
WindowProc = CallWindowProc(defWndProc, hwnd, uMsg, wParam, lParam)
End Select
End Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -