Delphi 读取内存数据

procedure TForm1.btn1Click(Sender: TObject);
const
GameName ='对对碰角色版';
var
GameH:HWND; //定义进程窗口句柄
PidGame:DWORD; //定义进程ID
readByte:DWORD; //实际读取字节
Gamehprocess: THandle; //可以理解为DWord,也就是非负数的整数类型 定义进程句柄
SitNum :DWORD;
begin
GameH:=FindWindow(nil,GameName); //获取游戏窗口句柄
GetWindowThreadProcessId(GameH,PidGame) ; //获取进程ID
Gamehprocess:=OpenProcess(PROCESS_VM_READ or PROCESS_VM_WRITE,false,PidGame); //获取进程句柄
Readprocessmemory(gamehProcess, Pointer($490FC0),@SitNum,4,readByte); //读出坐位号
Self.edt1.Text:=IntToHex(SitNum,8); //显示到编辑框中
end;

 

posted @ 2011-10-31 17:28  ahroot  阅读(1142)  评论(0编辑  收藏  举报