zoukankan      html  css  js  c++  java
  • 【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;




    没事,别怕,这是签名→→┃ 青山幽谷笛声扬,白鹤振羽任翱翔。往事前尘随风逝,携手云峰隐仙乡。 ┃
  • 相关阅读:
    我的家庭保险方案推荐
    如何修改Total Commander配件文件的位置
    豆瓣统计-2015
    RESTful API接口设计规范
    正则表达式中 的$1,$2与实际应用
    查询排序:order by case when理解、在order By子句中使用case语句的理解
    架构设计:BFF和Serverless简介
    移动端1px细线解决方案总结
    SpringMVC中实体类属性is开头的字段返回JSON时自动去掉is开头的问题
    详解JS面向对象的三大特征之多态
  • 原文地址:https://www.cnblogs.com/dabiao/p/2378790.html
Copyright © 2011-2022 走看看