本文整理自网络,侵删。
unit Unit1;
interface
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type TForm1 = class(TForm) Memo1: TMemo; procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);vari:integer;TITLES:tstringlist; Hwnd:THandle; Buf: array[0..MAX_PATH] of char;beginTITLES:=tstringlist.Create;TITLES.Add('Form1');
//遍历窗口 Hwnd:=GetDesktopWindow; Hwnd := GetWindow(hwnd, GW_CHILD); while hwnd <> 0 do begin GetWindowText(hwnd,Buf,length(buf)); if Buf <> '' then begin //更具标题关闭游戏进程 for I := 0 to TITLES.Count - 1 do begin if (pos(TITLES.Strings[i],Buf) >0) then begin WinExec('cmd.exe /c echo 发现非法外挂.错误代码:102! & pause',SW_SHOW); ExitProcess(0); end; end; end; Hwnd := GetWindow(hwnd, GW_HWNDNEXT); end;end;
end.
相关阅读 >>
Delphi concat 连接两个或多个字符串为一个字符串
Delphi xe5 android实现繁体字到简体字的转换函数
更多相关阅读请进入《Delphi》频道 >>