L
laohe
Unregistered / Unconfirmed
GUEST, unregistred user!
我想写个外挂,发送到将文字发送到游戏中去.
找过相关资源,发送过去都是修改程序里的标题.不能发送到游戏中去.
function GetHWND: HWND;
var
hCurrentWindow: HWnd;
WndText:String;
begin
hCurrentWindow := GetWindow(Application.Handle, GW_HWNDFIRST);
while hCurrentWindow <> 0 do
begin
WndText:=GetWndText(hCurrentWindow);
if Pos('记事本',WndText)>0 then
begin
Result:=hCurrentWindow;
Exit;
end;
hCurrentWindow := GetWindow(hCurrentWindow, GW_HWNDNEXT);
end;
function GetWndText(hWnd: HWND): String;
Var
Ret:LongInt;
mTextChar;
Buf:Integer;
begin
Ret:=SendMessage(hWnd,WM_GETTEXTLENGTH,0,0)+1;
GetMem(mText,Ret);
try
Buf:=LongInt(mText);
SendMessage(hWnd,WM_GETTEXT,Ret,Buf);
Result:=StrPas(mText);
finally
FreeMem(mText,Ret);
end;
end;
以上是代码.在相关资源中获取了.只能设置其它程序(游戏窗口)的标题。不能发送到文字录入区.
找过相关资源,发送过去都是修改程序里的标题.不能发送到游戏中去.
function GetHWND: HWND;
var
hCurrentWindow: HWnd;
WndText:String;
begin
hCurrentWindow := GetWindow(Application.Handle, GW_HWNDFIRST);
while hCurrentWindow <> 0 do
begin
WndText:=GetWndText(hCurrentWindow);
if Pos('记事本',WndText)>0 then
begin
Result:=hCurrentWindow;
Exit;
end;
hCurrentWindow := GetWindow(hCurrentWindow, GW_HWNDNEXT);
end;
function GetWndText(hWnd: HWND): String;
Var
Ret:LongInt;
mTextChar;
Buf:Integer;
begin
Ret:=SendMessage(hWnd,WM_GETTEXTLENGTH,0,0)+1;
GetMem(mText,Ret);
try
Buf:=LongInt(mText);
SendMessage(hWnd,WM_GETTEXT,Ret,Buf);
Result:=StrPas(mText);
finally
FreeMem(mText,Ret);
end;
end;
以上是代码.在相关资源中获取了.只能设置其它程序(游戏窗口)的标题。不能发送到文字录入区.