显示游戏人物金币数的VB代码,帮忙找错

[复制链接]
查看11 | 回复2 | 2010-11-26 23:02:38 | 显示全部楼层 |阅读模式
代码如下,目标是显示游戏里人物的金币数,完美游戏的基址刚算了几遍没错,金钱的偏移也没错,就是读不出游戏中人物的金币数。目前确认游戏窗口的进程pid没错,到进程句柄这以后就不知道对不对了,高手帮忙分析下
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private 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, ByVal lpBaseAddress As Long, ByVal lpBuffer As Byte, ByVal nSize As Long, ByRef lpNumberOfBytesWritten As Long) As Long
Const W2i_Base = &HA5BFCC
Private Sub Command1_Click()

Dim hwnd As Long

Dim pid As Long

Dim hprocess As Long

Dim ECXI As Long

Dim ECXIA As Long

Dim eax As Long

hwnd = FindWindow("ElementClient Window", "完美世界国际版")

GetWindowThreadProcessId hwnd, pid

hprocess = OpenProcess(&H1F0FFF, 0, pid)

If hprocess = 0 Then

Exit Sub

End If

'----金币信息---------------------------------------------

ReadProcessMemory hprocess, ByVal W2i_Base, ECXI, 4, 0

ReadProcessMemory hprocess, ByVal ECXI + &H20, ECXIA, 4, 0

ReadProcessMemory hprocess, ByVal ECXIA + &H538, eax, 4, 0

Me.Caption = "金钱:" & CStr(eax)
Text1.Text = CStr(eax)
End Sub

回复

使用道具 举报

千问 | 2010-11-26 23:02:38 | 显示全部楼层
代码太长懒得看了 我猜是游戏屏蔽了openprocess等API的调用 要么就是你权限不够 先提权
回复

使用道具 举报

千问 | 2010-11-26 23:02:38 | 显示全部楼层
不玩网络游戏,等楼下的
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行