niufen 发表于 2011-4-1 15:23:33

求助,Findwindow找不到窗口标题

var
Form1: TForm1;
Gameh:hwnd;             //游戏窗口句柄
Gamepid:Thandle;       //进程ID
GamehProcess:Thandle; //进程句柄
const
Gameyouxibiaot ='绿色征途 — 神话一区';
Gameyouxileiming='bewodrtkdotwqnvm';
Gamejizhi =$aa6590;
implementation

{$R *.dfm}
function GetRoleBase:integer;
var
ptmp:integer;
readByte:dword;
begin
result:=0;
Gameh:=Findwindow(nil,Gameyouxibiaot);
       if Gameh=0 then exit;
GetWindowThreadProcessID(Gameh,Gamepid);
Gamehprocess:=OpenProcess(windows.PROCESS_ALL_ACCESS,false,Gamepid);
ReadProcessMemory(GamehProcess,Pointer(Gamejizhi),@ptmp,4,readByte);
ReadProcessMemory(GamehProcess,Pointer(ptmp+$53c),@ptmp,4,readByte);
ReadProcessMemory(GamehProcess,Pointer(ptmp+$40),@ptmp,4,readByte);
result:=ptmp;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
self.edtcunBloob.Text:=intTostr(GetRoleBase);


窗口标题是用SPY++获得的,用句柄查看精灵修改窗口标题,可以读出游戏角色血值。
用游戏类名也可以读出游戏角色血值
我刚学Delphi,是仿照 郁金香教程 写的,
是不是游戏窗口标题太长了,所以读不到啊?
还有什么方法可以获取到游戏呢?
请各位高手帮帮忙。

叶落无痕 发表于 2011-4-1 15:24:05

Gameyouxibiaot ='绿色征途 — 神话一区';
Gameyouxileiming='bewodrtkdotwqnvm';

标题后面有空格, 类名会随机变的。。。
页: [1]
查看完整版本: 求助,Findwindow找不到窗口标题