谁帮我把这个代码补全了,完全新手,想看看效果。 ( 积分: 250 )

  • 主题发起人 主题发起人 ckzx
  • 开始时间 开始时间
C

ckzx

Unregistered / Unconfirmed
GUEST, unregistred user!
//,把ReadM函数的说明写上去就行了。<br><br>function&nbsp;TForm1.ReadM(lpAdd:Dword):Dword;<br>var<br>hwd:integer;&nbsp;//存放窗口句柄<br>pid:integer;&nbsp;//存放进程ID<br>hProcess:integer;&nbsp;//存放进程句柄<br>lpBuffer:Dword;&nbsp;//函数ReadProcessMemory的参数<br>lpNumber:Dword;&nbsp;//同上<br><br>const<br>GName='Element&nbsp;Client';&nbsp;&nbsp;&nbsp;//定义常量为游戏窗口名<br><br>begin<br>hwd:=FindWindow(nil,GName);&nbsp;&nbsp;&nbsp;//获取游戏窗口句柄<br>if&nbsp;hwd&lt;&gt;0&nbsp;then<br>&nbsp;&nbsp;begin<br>&nbsp;&nbsp;&nbsp;&nbsp;GetWindowThreadProcessId(hwd,@pid);&nbsp;//取进程标识符<br>&nbsp;&nbsp;&nbsp;&nbsp;hProcess:=OpenProcess(PROCESS_ALL_ACCESS,false,pid);&nbsp;//以最高权限打开进程<br>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;hProcess&nbsp;&lt;&gt;&nbsp;0&nbsp;then<br>&nbsp;&nbsp;&nbsp;&nbsp;ReadProcessMemory(hProcess,Pointer(lpAdd),@lpBuffer,4,lpNumber);<br>&nbsp;&nbsp;&nbsp;&nbsp;CloseHandle(hProcess);<br>&nbsp;&nbsp;end;<br>&nbsp;&nbsp;result:=lpBuffer;<br>end;<br><br><br><br><br>{$R&nbsp;*.dfm}<br><br>procedure&nbsp;TForm1.FormClick(Sender:&nbsp;TObject);<br>var<br>hwd:integer;&nbsp;//存放窗口句柄<br>pid:integer;&nbsp;//存放进程标识<br>hProcess:integer;&nbsp;//存放进程句柄<br>lpBuffer:DWORD;<br>lpNumber:DWORD;<br><br>const<br>GName='Element&nbsp;Client';<br><br>begin<br>hwd:=FindWindow(nil,GName);&nbsp;//获取窗口句柄<br>if&nbsp;hwd=0&nbsp;then<br>begin<br>&nbsp;&nbsp;showmessage('游戏未运行');<br>&nbsp;&nbsp;exit;<br>end<br>else<br>timer1.Interval:=100;<br>edit1.Text:='游戏窗口句柄为:'+inttostr(hwd);<br>GetWindowThreadProcessId(hwd,@pid);&nbsp;//获取进程标识<br>edit2.Text:='游戏进程标识为:'+inttostr(pid);<br>hProcess:=OpenProcess(PROCESS_ALL_ACCESS,false,pid);&nbsp;//打开进程<br>if&nbsp;hProcess&nbsp;=&nbsp;0&nbsp;then<br>&nbsp;&nbsp;showmessage('打开进程错误');<br>edit3.Text:='游戏进程句柄为:'+inttostr(hProcess);<br><br>end;<br><br>procedure&nbsp;TForm1.Timer1Timer(Sender:&nbsp;TObject);<br>var<br>Now_Hp:integer;&nbsp;//存放当前HP值<br>Now_Mp:integer;&nbsp;//存放当前MP值<br>lpAddress:Dword;&nbsp;//存放地址指针<br>const<br>lpAdd=$008dbcdc;<br>begin<br>lpAddress:=ReadM(lpAdd);&nbsp;//获取一级指针地址<br>lpAddress:=ReadM(lpAddress+32);&nbsp;//获取二级指针地址<br>Now_Hp:=ReadM(lpAddress+1104);&nbsp;&nbsp;&nbsp;//获取HP<br>Now_Mp:=ReadM(lpAddress+1108);&nbsp;&nbsp;&nbsp;//获取MP<br>label2.Caption&nbsp;:=inttostr(Now_Hp);<br>label4.Caption&nbsp;:=inttostr(Now_Mp);<br><br>end;<br><br>想问下,readm函数怎么说明?能不能有人帮我补全了。谢谢了。
 
楼主在写诛仙的外挂吧<br>把ReadM函数的说明写上去就行了。什么意思?<br>你这个函数少什么东西吗?
 
这是一个显血,显蓝的IP。网上找的。可惜上面那句注释把ReadM函数的说明写上去看不明白。我想把前面的补全,我加入lable&nbsp;timer,但是运行在function&nbsp;TForm1.ReadM(lpAdd:Dword):Dword;&nbsp;提示没有定义!
 
代码没有任何问题啊,晕,全部都通过,不明白你要问的是什么问题<br>unit&nbsp;Unit1;<br><br>interface<br><br>uses<br>&nbsp;&nbsp;Windows,&nbsp;Messages,&nbsp;SysUtils,&nbsp;Variants,&nbsp;Classes,&nbsp;Graphics,&nbsp;Controls,&nbsp;Forms,<br>&nbsp;&nbsp;Dialogs,&nbsp;StdCtrls,&nbsp;ExtCtrls;<br><br>type<br>&nbsp;&nbsp;TForm1&nbsp;=&nbsp;class(TForm)<br>&nbsp;&nbsp;&nbsp;&nbsp;Button1:&nbsp;TButton;<br>&nbsp;&nbsp;&nbsp;&nbsp;Timer1:&nbsp;TTimer;<br>&nbsp;&nbsp;&nbsp;&nbsp;Edit1:&nbsp;TEdit;<br>&nbsp;&nbsp;&nbsp;&nbsp;Edit2:&nbsp;TEdit;<br>&nbsp;&nbsp;&nbsp;&nbsp;Edit3:&nbsp;TEdit;<br>&nbsp;&nbsp;&nbsp;&nbsp;Label1:&nbsp;TLabel;<br>&nbsp;&nbsp;&nbsp;&nbsp;Label2:&nbsp;TLabel;<br>&nbsp;&nbsp;&nbsp;&nbsp;Label3:&nbsp;TLabel;<br>&nbsp;&nbsp;&nbsp;&nbsp;Label4:&nbsp;TLabel;<br>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;FormClick(Sender:&nbsp;TObject);<br>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;Timer1Timer(Sender:&nbsp;TObject);<br>&nbsp;&nbsp;private<br>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;Private&nbsp;declarations&nbsp;}<br>&nbsp;&nbsp;public<br>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;Public&nbsp;declarations&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;ReadM(lpAdd:Dword):Dword;<br>&nbsp;&nbsp;end;<br><br>var<br>&nbsp;&nbsp;Form1:&nbsp;TForm1;<br><br>implementation<br><br>{$R&nbsp;*.dfm}<br><br>{&nbsp;TForm1&nbsp;}<br><br>function&nbsp;TForm1.ReadM(lpAdd:&nbsp;Dword):&nbsp;Dword;<br>var<br>hwd:integer;&nbsp;//存放窗口句柄<br>pid:integer;&nbsp;//存放进程ID<br>hProcess:integer;&nbsp;//存放进程句柄<br>lpBuffer:Dword;&nbsp;//函数ReadProcessMemory的参数<br>lpNumber:Dword;&nbsp;//同上<br><br>const<br>GName='Element&nbsp;Client';&nbsp;&nbsp;&nbsp;//定义常量为游戏窗口名<br><br>begin<br>hwd:=FindWindow(nil,GName);&nbsp;&nbsp;&nbsp;//获取游戏窗口句柄<br>if&nbsp;hwd&lt;&gt;0&nbsp;then<br>&nbsp;&nbsp;begin<br>&nbsp;&nbsp;&nbsp;&nbsp;GetWindowThreadProcessId(hwd,@pid);&nbsp;//取进程标识符<br>&nbsp;&nbsp;&nbsp;&nbsp;hProcess:=OpenProcess(PROCESS_ALL_ACCESS,false,pid);&nbsp;//以最高权限打开进程<br>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;hProcess&nbsp;&lt;&gt;&nbsp;0&nbsp;then<br>&nbsp;&nbsp;&nbsp;&nbsp;ReadProcessMemory(hProcess,Pointer(lpAdd),@lpBuffer,4,lpNumber);<br>&nbsp;&nbsp;&nbsp;&nbsp;CloseHandle(hProcess);<br>&nbsp;&nbsp;end;<br>&nbsp;&nbsp;result:=lpBuffer;<br><br>end;<br><br>procedure&nbsp;TForm1.FormClick(Sender:&nbsp;TObject);<br>var<br>hwd:integer;&nbsp;//存放窗口句柄<br>pid:integer;&nbsp;//存放进程标识<br>hProcess:integer;&nbsp;//存放进程句柄<br>lpBuffer:DWORD;<br>lpNumber:DWORD;<br><br>const<br>GName='Element&nbsp;Client';<br><br>begin<br>hwd:=FindWindow(nil,GName);&nbsp;//获取窗口句柄<br>if&nbsp;hwd=0&nbsp;then<br>begin<br>&nbsp;&nbsp;showmessage('游戏未运行');<br>&nbsp;&nbsp;exit;<br>end<br>else<br>timer1.Interval:=100;<br>edit1.Text:='游戏窗口句柄为:'+inttostr(hwd);<br>GetWindowThreadProcessId(hwd,@pid);&nbsp;//获取进程标识<br>edit2.Text:='游戏进程标识为:'+inttostr(pid);<br>hProcess:=OpenProcess(PROCESS_ALL_ACCESS,false,pid);&nbsp;//打开进程<br>if&nbsp;hProcess&nbsp;=&nbsp;0&nbsp;then<br>&nbsp;&nbsp;showmessage('打开进程错误');<br>edit3.Text:='游戏进程句柄为:'+inttostr(hProcess);<br><br>end;<br><br>procedure&nbsp;TForm1.Timer1Timer(Sender:&nbsp;TObject);<br>var<br>Now_Hp:integer;&nbsp;//存放当前HP值<br>Now_Mp:integer;&nbsp;//存放当前MP值<br>lpAddress:Dword;&nbsp;//存放地址指针<br>const<br>lpAdd=$008dbcdc;<br>begin<br>lpAddress:=ReadM(lpAdd);&nbsp;//获取一级指针地址<br>lpAddress:=ReadM(lpAddress+32);&nbsp;//获取二级指针地址<br>Now_Hp:=ReadM(lpAddress+1104);&nbsp;&nbsp;&nbsp;//获取HP<br>Now_Mp:=ReadM(lpAddress+1108);&nbsp;&nbsp;&nbsp;//获取MP<br>label2.Caption&nbsp;:=inttostr(Now_Hp);<br>label4.Caption&nbsp;:=inttostr(Now_Mp);<br><br>end;<br><br>end.
 
ReadM就是读指定进程指定地址的值
 
后退
顶部