Delphi 遍历系统窗口标题可用于反外挂反破解


本文整理自网络,侵删。

 
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);
var
i:integer;
TITLES:tstringlist;
  Hwnd:THandle;
  Buf: array[0..MAX_PATH] of char;
begin
TITLES:=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实现音频传输

Delphi 相对路径

Delphi 之 列表框组件(tlistbox)

Delphi 开关显示器操作

Delphi concat 连接两个或多个字符串为一个字符串

Delphi 复制文件到剪贴板

Delphi 锁定鼠标移动范围

Delphi中in的使用

Delphi根据url获取缓存文件的方法

Delphi xe5 android实现繁体字到简体字的转换函数

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...