C
ckzx
Unregistered / Unconfirmed
GUEST, unregistred user!
//,把ReadM函数的说明写上去就行了。<br><br>function TForm1.ReadM(lpAddword)word;<br>var<br>hwd:integer; //存放窗口句柄<br>pid:integer; //存放进程ID<br>hProcess:integer; //存放进程句柄<br>lpBufferword; //函数ReadProcessMemory的参数<br>lpNumberword; //同上<br><br>const<br>GName='Element Client'; //定义常量为游戏窗口名<br><br>begin<br>hwd:=FindWindow(nil,GName); //获取游戏窗口句柄<br>if hwd<>0 then<br> begin<br> GetWindowThreadProcessId(hwd,@pid); //取进程标识符<br> hProcess:=OpenProcess(PROCESS_ALL_ACCESS,false,pid); //以最高权限打开进程<br> if hProcess <> 0 then<br> ReadProcessMemory(hProcess,Pointer(lpAdd),@lpBuffer,4,lpNumber);<br> CloseHandle(hProcess);<br> end;<br> result:=lpBuffer;<br>end;<br><br><br><br><br>{$R *.dfm}<br><br>procedure TForm1.FormClick(Sender: TObject);<br>var<br>hwd:integer; //存放窗口句柄<br>pid:integer; //存放进程标识<br>hProcess:integer; //存放进程句柄<br>lpBufferWORD;<br>lpNumberWORD;<br><br>const<br>GName='Element Client';<br><br>begin<br>hwd:=FindWindow(nil,GName); //获取窗口句柄<br>if hwd=0 then<br>begin<br> showmessage('游戏未运行');<br> exit;<br>end<br>else<br>timer1.Interval:=100;<br>edit1.Text:='游戏窗口句柄为:'+inttostr(hwd);<br>GetWindowThreadProcessId(hwd,@pid); //获取进程标识<br>edit2.Text:='游戏进程标识为:'+inttostr(pid);<br>hProcess:=OpenProcess(PROCESS_ALL_ACCESS,false,pid); //打开进程<br>if hProcess = 0 then<br> showmessage('打开进程错误');<br>edit3.Text:='游戏进程句柄为:'+inttostr(hProcess);<br><br>end;<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>var<br>Now_Hp:integer; //存放当前HP值<br>Now_Mp:integer; //存放当前MP值<br>lpAddressword; //存放地址指针<br>const<br>lpAdd=$008dbcdc;<br>begin<br>lpAddress:=ReadM(lpAdd); //获取一级指针地址<br>lpAddress:=ReadM(lpAddress+32); //获取二级指针地址<br>Now_Hp:=ReadM(lpAddress+1104); //获取HP<br>Now_Mp:=ReadM(lpAddress+1108); //获取MP<br>label2.Caption :=inttostr(Now_Hp);<br>label4.Caption :=inttostr(Now_Mp);<br><br>end;<br><br>想问下,readm函数怎么说明?能不能有人帮我补全了。谢谢了。