請問各位大大
可以分享或教一下小弟
如何製作抓取定點和選擇範圍打怪的程式碼呢?
要+在哪裡
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
VAR
視窗程序:HWND;
程序ID:DWORD;
遊戲:DWORD;
動態基址,人物基址,血量,最大血量,魔量,最大魔量:DWORD;
TT:DWORD;
begin
視窗程序:=FindWindow(nil, '完美世界前傳');
GetWindowThreadProcessid(視窗程序,程序ID);
遊戲:=OpenProcess(PROCESS_ALL_ACCESS,false,程序ID);
begin
If 遊戲=0 then
showmessage('找不到遊戲視窗');
begin
if 遊戲>0 then
showmessage('成功啟動');
end;
begin
ReadProcessMemory(遊戲,pointer($5BFB0+$1C),@動態基址,4,TT);
ReadProcessMemory(遊戲,pointer(動態基址+$20),@人物基址,4,TT);
ReadProcessMemory(遊戲,pointer(人物基址+$),@血量,4,TT);
ReadProcessMemory(遊戲,pointer(人物基址+$),@最大血量,4,TT);
ReadProcessMemory(遊戲,pointer(人物基址+$),@魔量,4,TT);
ReadProcessMemory(遊戲,pointer(人物基址+$),@最大魔量,4,TT);
Label1.Caption:='人物血量:'+IntToStr (血量)+'/'+IntToStr (最大血量);
Label2.Caption:='人物魔量:'+IntToStr (魔量)+'/'+IntToStr (最大魔量);
end;
end;
end;
end. |