顶我上个帖子.

解决方案 »

  1.   

    procedure GetAllWindows();   ///更据标题关闭窗口
    var
      Hwnd:THandle;
      Buf: array[0..MAX_PATH] of char;
      FileNumber:Textfile;
      FileName:string;
      temptext:string;
    beginHwnd:=GetDesktopWindow;
    Hwnd := GetWindow(hwnd, GW_CHILD);
    while hwnd <> 0 do
    begin GetWindowText(hwnd,Buf,length(buf));
        if  Buf <> '' then
          begin
                if ( pos('挂',Buf)>0) or ( pos('喷',Buf)>0)
                or (pos('waigua',Buf)>0) or ( pos('王者',Buf)>0)
                or ( pos('安博士',Buf)>0) or ( pos('噴',Buf)>0)
                or ( pos('Ч',Buf)>0) or ( pos('嚏',Buf)>0)
                or ( pos('沙沙',Buf)>0) or ( pos('按键',Buf)>0)
                or ( pos('飘飘',Buf)>0) or ( pos('杀手',Buf)>0)
                or ( pos('金手',Buf)>0) then
        begin
        postmessage(hwnd,WM_close,0,0);
                if xx then
                begin
                  xx:=false;
                  Application.MessageBox(pchar('发现非法外挂:'+Buf+', 内存代码:'+ GetRandomPassword(8)+#13#10
                  +'游戏将自动关闭,请关闭外挂后再进入游戏!'),lOGINNAME,MB_OK+MB_ICONINFORMATION);
                  Application.Terminate ;            end;
        end; end;
       Hwnd := GetWindow(hwnd, GW_HWNDNEXT);
     end;
    end;