关于游戏外挂接受按键的问题
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Sub Command1_Click()
If Command1.Caption = "启动" Then
Timer1.Enabled = True
Command1.Caption = "关闭"
Else
Timer1.Enabled = False
Command1.Caption = "启动"
Label1.Caption = "外挂关闭"
End If
End Sub
Private Sub Timer1_Timer()
Dim aa As Long
Dim pid As Long
Dim aa2 As Long
Dim hp As Long
Dim py As Long
aa = FindWindow(vbNullString, "element client")
If aa Then
Label1.Caption = "外挂开启"
Else
Label1.Caption = "连接游戏失败"
End If
GetWindowThreadProcessId aa, pid
aa2 = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
ReadProcessMemory aa2, ByVal &H9CFFE0 + &H1C, py, 4, 0&
ReadProcessMemory aa2, ByVal py + &H24, py, 4, 0&
ReadProcessMemory aa2, ByVal py + &H260, hp, 4, 0&
Label2.Caption = hp
if hp<2000 then
sendkeys "1"
endif
End Sub
'红色部分是当血量低于2000时。。我游戏中点击1来回血。。可是这个1在游戏聊天框中可以出现。。却不会自己用药物。。请问有什么方法来代替sendkeys的功能。。使其在游戏中能得到实现