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 try 抛出异常消息

Delphi wm_copydata 用法

Delphi firedac 获取 insert 记录的自增 id

Delphi函数assignfile使用

Delphi中将dbgrid中的内容输出到word中

Delphi idhttp批量上传图片

Delphi 根据窗口类判断程序是否运行

Delphi fdmemtable内存表操作

Delphi 获取internet缓存文件

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



打赏

取消

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

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

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

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

评论

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