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 Sub Command1_Click()
jb = FindWindow("*GodClass*", "aaaaaa")
Call GetWindowThreadProcessId(jb, dq)
lj = OpenProcess(jb, True, dq)
(上面代码没有任何问题)
Private Sub Timer1_Timer()
Dim jz As Byte
(Dim jz As long这个也试过了)
ReadProcessMemory lj, ByVal &H431AA0 , jz, 4, 0&
Dim err As Long
err = GetLastError()
Print err
end sub
GetLastError()不知道是不是这样用,err一直显示6
jz的返回值为0用CE看&H431AA0这地址的值并不是0
不知啥问题啊,大虾们帮忙分析下啊,谢谢啦!!!
ReadProcessMemory为什么总是返回0啊
答案:1 悬赏:50 手机版
解决时间 2021-08-18 19:33
- 提问者网友:最美的风景
- 2021-08-18 07:05
最佳答案
- 五星知识达人网友:深街酒徒
- 2021-08-18 08:28
查找游戏的内存地址用Cheat Engine、金山游侠。Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As LongPrivate Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As LongPrivate Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As LongPrivate Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As LongPrivate Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As LongPrivate Const PROCESS_ALL_ACCESS = &H1F0FFFPrivate Const PROCESS_VM_OPERATION = &H8&Private Const PROCESS_VM_READ = &H10&Private Const PROCESS_VM_WRITE = &H20&Private Sub Form_Load()Timer1.Enabled = TrueLabel1.Caption = ""End SubPrivate Sub Timer1_Timer()Dim hwnd As Longhwnd = FindWindow(vbNullString, "大家来找茬 - 未购买用户")If hwnd = 0 ThenLabel1.Caption = "游戏未启动"Option1.Enabled = FalseOption2.Enabled = FalseOption3.Enabled = FalseTimer2.Enabled = FalseElseLabel1.Caption = "游戏已启动"Timer2.Enabled = TrueOption1.Enabled = TrueOption2.Enabled = TrueOption3.Enabled = TrueEnd IfEnd SubPrivate Sub Timer2_Timer()Dim hwnd As LongDim PId As LongDim pHandle As Longhwnd = FindWindow(vbNullString, "大家来找茬 - 未购买用户")GetWindowThreadProcessId hwnd, PIdpHandle = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, 0, PId)If Option1.Value = True Then WriteProcessMemory pHandle, ByVal &H
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯