1,486
社区成员
发帖
与我相关
我的任务
分享
Function DLLMain(ByVal A As Long, ByVal B As Long, ByVal c As Long) As Long
Instance = A
Init
DLLMain = 1
End Function
Sub Main()
End Sub
Function SetHok()
Dim hwnd As Long
hwnd = FindWindow("TFrmMain", "传奇3")
If hwnd = 0 Then
MsgBox "先运行游戏"
Exit Function
End If
Dim tid As Long
Dim pid As Long
Dim SH As Long
tid = GetWindowThreadProcessId(hwnd, vbNull)
'方法一 不行
SH = SetWindowsHookEx(WH_KEYBOARD, AddressOf LowLevelKeyboardProc, Instance, 0)
'方法二 不行
SH = SetWindowsHookEx(WH_KEYBOARD, AddressOf LowLevelKeyboardProc, GetModuleHandle("add.dll"), tid)
End Function
Function LowLevelKeyboardProc(ByVal ncode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
‘ MsgBox "ok"
If ncode = HC_ACTION Then
CopyMemory p, ByVal lParam, Len(p)
If p.VKCode = VK_HOME Then
Form1.Show
End If
End If
CallNextHookEx WH_KEYBOARD, ncode, wParam, lParam
End Function
Function Init() As Boolean
hModule = LoadLibrary("ws2_32.dll")
PfConnect = GetProcAddress(hModule, "connect")
If PfConnect = 0 Then
Init = False
Else
End If
End Function
Function DLLMain(ByVal A As Long, ByVal B As Long, ByVal c As Long) As Long
Instance = A
Init
DLLMain = 1
End Function
Sub Main()
End Sub
Function SetHok()
Dim hwnd As Long
hwnd = FindWindow("TFrmMain", "传奇3")
If hwnd = 0 Then
MsgBox "先运行游戏"
Exit Function
End If
Dim tid As Long
Dim pid As Long
Dim SH As Long
tid = GetWindowThreadProcessId(hwnd, vbNull)
'方法一 不行
SH = SetWindowsHookEx(WH_KEYBOARD, AddressOf LowLevelKeyboardProc, Instance, 0)
'方法二 不行
SH = SetWindowsHookEx(WH_KEYBOARD, AddressOf LowLevelKeyboardProc, GetModuleHandle("add.dll"), tid)
End Function
Function LowLevelKeyboardProc(ByVal ncode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
‘ MsgBox "ok"
If ncode = HC_ACTION Then
CopyMemory p, ByVal lParam, Len(p)
If p.VKCode = VK_HOME Then
Form1.Show
End If
End If
CallNextHookEx WH_KEYBOARD, ncode, wParam, lParam
End Function
Function Init() As Boolean
hModule = LoadLibrary("ws2_32.dll")
PfConnect = GetProcAddress(hModule, "connect")
If PfConnect = 0 Then
Init = False
Else
End If
End Function