赐福与你钢琴伴奏谱:关于VB读取内存数据

来源:百度文库 编辑:高考问答 时间:2024/05/02 03:05:41
模块:
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Private Sub Command1_Click()
Dim hwnd As Long
Dim pid As Long
Dim pHandle As Long
Dim str As String
hwnd = FindWindow(vbNullString, "QQ幻想1.21")
If (hwnd = 0) Then
MsgBox "Window not found!"
Exit Sub
End If

GetWindowThreadProcessId hwnd, pid
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If (pHandle = 0) Then
MsgBox “错误” 'pHandle 一直等0 是怎么回事呢???
Exit Sub
End If
' 在内存地址中写入名字
'WriteProcessMemory pHandle, &H40B181, "Beans", 5, 0&
ReadProcessMemory pHandle, &H4584C58, str, 20, 0&
Text1.Text = str
CloseHandle hProcess
End Sub

一直提示错误。无法读到数据。。看看。 帮帮我哦
我的意思是,做个QQ幻想的辅助工具,自动喝红的。
在内存里找到血量值的地址,然后通过VB访问那个地址。读取出来。

你确定没错地址吗

在内存地址中写入名字
晕~写内存是外挂啊
应该让他模拟按键
SendKeys "a"
按键A

你给这么点分要我们卖命

谁会干啊

看不懂
你打错了吧`~