• 【Delphi】写了一个类似小外挂的程序 O(∩_∩)O~



    程序说明:

    A程序:点一次按钮,产生一组随机数,只有随机数为4、4、9、9时,才会弹出"可以啦,恭喜啊~"字样。

    B程序:读取A程序随机产生的4组数,如果发现不是4、4、9、9,则进行一次虚拟的A程序按键操作。


    程序界面:


    程序代码:

    A程序
    procedure TForm1.btn2Click(Sender: TObject);
    begin
    edt1.Text := IntToStr(Random(10));
    edt2.Text := IntToStr(Random(10));
    edt3.Text := IntToStr(Random(10));
    edt4.Text := IntToStr(Random(10));

    if (edt1.Text = '4') and (edt2.Text = '4') and (edt3.Text = '9') and (edt4.Text = '9')then
    begin
    lbl6.Font.Color := clRed;
    lbl6.Caption := '可以啦,恭喜啊!!!';
    end;

    end;
    B程序
    procedure TForm2.btn1Click(Sender: TObject);
    var
    Gameh:HWND;
    buttonh:HWND;
    buttonc:HWND;
    i:Integer;
    Grp1h:HWND;
    edt1h,edt2h,edt3h,edt4h,C:HWND;
    text1,text2,text3,text4:ansistring;
    p: array[0..254] of ansichar;
    begin
    Gameh := FindWindow(nil,'Good!!!!');

    if Gameh = 0 then
    ShowMessage('Error')
    else
    begin
    buttonh := FindWindowEx(Gameh,0,'TButton','btn1');
    C:=findwindowex(Gameh,0,'TEdit',0);

    i:=0;
    while C <> 0 do
    begin
    if (i=0) then
    begin
    edt4h := C;
    SendMessage(C,WM_GETTEXT,100,integer(@p));
    text4 := p;
    i := i + 1;
    end
    else if (i=1) then
    begin
    edt1h := C;
    SendMessage(C,WM_GETTEXT,100,integer(@p));
    text1 := p;
    i := i + 1;
    end
    else if (i=2) then
    begin
    edt2h := C;
    SendMessage(C,WM_GETTEXT,100,integer(@p));
    text2 := p;
    i := i + 1;
    end
    else
    begin
    edt3h := C;
    SendMessage(C,WM_GETTEXT,100,integer(@p));
    text3 := p;
    end;

    C:=findwindowex(Gameh,c,'TEdit',0);//查找下一个
    end;

    while not ((text4 = '9') and (text3 = '9') and (text2 = '4') and (text1 = '4')) do
    begin
    buttonc := FindWindowEx(Gameh,0,'TButton','生成');
    if buttonc = 0 then
    Exit;

    SendMessage(buttonc,WM_LBUTTONDOWN,0,$000F000E);
    SendMessage(buttonc,WM_LBUTTONUP,0,$000F000E);

    C:=findwindowex(Gameh,c,'TEdit',0);

    i:=0;
    while C <> 0 do
    begin

    if (i=0) then
    begin
    edt4h := C;
    SendMessage(C,WM_GETTEXT,100,integer(@p));
    text4 := p;
    i := i + 1;
    end
    else if (i=1) then
    begin
    edt1h := C;
    SendMessage(C,WM_GETTEXT,100,integer(@p));
    text1 := p;
    i := i + 1;
    end
    else if (i=2) then
    begin
    edt2h := C;
    SendMessage(C,WM_GETTEXT,100,integer(@p));
    text2 := p;
    i := i + 1;
    end
    else
    begin
    edt3h := C;
    SendMessage(C,WM_GETTEXT,100,integer(@p));
    text3 := p;
    i:=0;
    end;

    C:=findwindowex(Gameh,c,'TEdit',0);//查找下一个
    end;
    end;


    end;
    end;




    没事,别怕,这是签名→→┃ 青山幽谷笛声扬,白鹤振羽任翱翔。往事前尘随风逝,携手云峰隐仙乡。 ┃
  • 相关阅读:
    MCU开发之I2C通信
    hibernate特殊的映射
    Hibernate使用
    css设置让a标签充满整个li
    margin
    border属性
    列表
    链接样式
    相机内参外参
    tmux
  • 原文地址:https://www.cnblogs.com/dabiao/p/2378790.html
Copyright © 2020-2023  润新知