⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qqllk.dpr

📁 Delphi QQ连连看外挂源码。 利用全局DLL监控
💻 DPR
📖 第 1 页 / 共 2 页
字号:

    WM_LBUTTONDOWN:
      begin
        pt.x := LOWORD(lParam);
        pt.y := HIWORD(lParam);
        if (PtInRect(rcCaption, pt)) then
          PostMessage(hDlg, WM_NCLBUTTONDOWN, HTCAPTION, 0);
      end;

    WM_PAINT:
      begin
        h_dc := BeginPaint(hDlg, ps);
        PaintCaption(h_dc, h_Icon, szAboutCaption, rcCaption, clFrom, clTo);
        EndPaint(hDlg, ps);
      end;

    WM_COMMAND:
      begin
        case wParam of
          ABOUT_OK:
            begin
              KillTimer(hDlg, 168); //销毁定时器
              EndDialog(hDlg, 0);
            end;
          ABOUT_CLOSE:
            begin
              KillTimer(hDlg, 168); //销毁定时器
              EndDialog(hDlg, 0);
            end;
        end;
        result := 0;
      end;

    WM_DRAWITEM:
      begin
        pdis := PDRAWITEMSTRUCT(lParam);
        DrawButton(pdis);
        Result := 0;
      end;
    ///////////////////////////////////////////////////
    //响应绘制窗体内容消息
    WM_CTLCOLORDLG:
      begin
        SetTextColor(wParam, clText);
        SetBkMode(wParam, TRANSPARENT);
        Result := BKC;
      end;
    WM_CTLCOLORSTATIC:
      begin
        SetTextColor(wParam, clText);
        SetBkMode(wParam, TRANSPARENT);
        Result := BKC;
      end;
  else
    Result := 0;
  end;
end;
function OptionProc(hDlg: HWND; Msg, wParam, lParam: DWORD): LRESULT; stdcall;
const
  rcCaption: TRECT = ();
  i: smallint = 0;
  w: smallint = 0;
  h: smallint = 0;
  h_Memo: HWND = 0;
  memo: HWND = 0;
  lines: smallint = 1; //字幕行数
var
  h_dc: HDC;
  ps: TPAINTSTRUCT;
  pdis: PDRAWITEMSTRUCT;
  pt: TPOINT;
  h_Font: HFONT;
  h_File: HWND;
  e: integer;
begin
  case Msg of
    WM_INITDIALOG:
      begin
        GetClientRect(hDlg, rcCaption);
        rcCaption.bottom := rcCaption.top + 20;

        h_Memo := GetDlgItem(hDlg, ABOUT_MEMO);
        h_File := GetDlgItem(hDlg, ABOUT_FILE);
        h_Font := CreateFont(-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET,
          OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH
          or FF_DONTCARE, '宋体');
        SendMessage(h_File, WM_SETFONT, h_Font, 0);

        CheckDlgButton(hdlg, OPTION_AUTOSTART, ord(g_AutoStart));
        CheckDlgButton(hdlg, OPTION_AUTOTOOLS, ord(g_AutoTools));
        CheckDlgButton(hdlg, OPTION_RANDOM, ord(g_Random));
        CheckDlgButton(hdlg, OPTION_COMPUTER, ord(g_Computer));
        SetDlgItemText(hDlg, OPTION_TIMER, g_timer);

        result := 1;
      end;

    WM_LBUTTONDOWN:
      begin
        pt.x := LOWORD(lParam);
        pt.y := HIWORD(lParam);
        if (PtInRect(rcCaption, pt)) then
          PostMessage(hDlg, WM_NCLBUTTONDOWN, HTCAPTION, 0);
      end;

    WM_PAINT:
      begin
        h_dc := BeginPaint(hDlg, ps);
        PaintCaption(h_dc, h_Icon, szOptionCaption, rcCaption, clFrom, clTo);
        EndPaint(hDlg, ps);
      end;

    WM_COMMAND:
      begin
        case wParam of
          OPTION_OK:
            begin

              g_AutoStart := IsDlgButtonChecked(hDlg, OPTION_AUTOSTART) =
                BST_CHECKED;
              g_AutoTools := IsDlgButtonChecked(hDlg, OPTION_AUTOTOOLS) =
                BST_CHECKED;
              g_Random := IsDlgButtonChecked(hDlg, OPTION_RANDOM) =
                BST_CHECKED;
              g_Computer := IsDlgButtonChecked(hDlg, OPTION_COMPUTER) =
                BST_CHECKED;
              GetDlgItemText(hDlg, OPTION_TIMER, g_timer, 255);
              //LineGames.AutoStart;
              Val(g_timer, g_internal, E);
              if (E <> 0) or (g_internal < 500) or (g_internal > 10000) then
              begin
                g_internal := 1000;
                MessageBox(hDlg, pchar('请输入一个有效的整数(500~10000)!'),
                  pchar('输入错误'),
                  MB_ICONERROR);
                exit;
              end;
              if g_autostart or g_Computer then
                SetTimer(h_mainDlg, 169, g_internal, nil)
              else
                KillTimer(h_mainDlg, 169);
              //设定定时器每1000毫秒触发一次
              EndDialog(hDlg, 0);
            end;
          OPTION_ABOUT: DialogBox(h_Inst, LPCTSTR(IDD_ABOUTDLG), hDlg,
              @AboutProc);

          OPTION_CANCEL, OPTION_CLOSE:
            begin
              EndDialog(hDlg, 0);
            end;
        end;
        result := 0;
      end;

    WM_DRAWITEM:
      begin
        pdis := PDRAWITEMSTRUCT(lParam);
        DrawButton(pdis);
        Result := 0;
      end;
    ///////////////////////////////////////////////////
    //响应绘制窗体内容消息
    WM_CTLCOLORDLG:
      begin
        SetTextColor(wParam, clText);
        SetBkMode(wParam, TRANSPARENT);
        Result := BKC;
      end;
    WM_CTLCOLORSTATIC:
      begin
        SetTextColor(wParam, clText);
        SetBkMode(wParam, TRANSPARENT);
        Result := BKC;
      end;
  else
    Result := 0;
  end;
end;

function MainProc(hDlg: HWND; Msg, wParam, lParam: DWORD): LRESULT; stdcall;
const
  rcCaption: TRECT = ();
var
  h_dc: HDC;
  ps: TPAINTSTRUCT;
  pdis: PDRAWITEMSTRUCT;
  pt: TPOINT;
begin
  case Msg of
    WM_INITDIALOG:
      begin
        h_mainDlg := hDlg;
        GetClientRect(hDlg, rcCaption);
        rcCaption.bottom := rcCaption.top + 20;
        SetWindowText(hDlg, szMainCaption);
        AnimateShow(hDlg);

        if (RegisterHotKey(hDlg, ID_HOTKEYF2, 0, VK_F2) = false) then
        begin
          //hotkey注册
          //失败了的话...
          MessageBox(hDlg, pchar('注册热键F2失败!'), pchar('Error'),
            MB_ICONERROR);
          PostQuitMessage(0);
        end;
        if (RegisterHotKey(hDlg, ID_HOTKEYF3, 0, VK_F3) = false) then
        begin
          //hotkey注册
          //失败了的话...
          MessageBox(hDlg, pchar('注册热键F3失败!'), pchar('Error'),
            MB_ICONERROR);
          PostQuitMessage(0);
        end;
        if (RegisterHotKey(hDlg, ID_HOTKEYCTRLF4, MOD_CONTROL, VK_F4) = false)
          then
        begin
          //hotkey注册
          //失败了的话...
          MessageBox(hDlg, pchar('注册热键CTRL+F4失败!'), pchar('Error'),
            MB_ICONERROR);
          PostQuitMessage(0);
        end;
        result := 1;
      end;
    WM_HOTKEY: //处理WM_HOTKEY消息
      begin
        case HIWORD(lParam) of
          VK_F3: LineGames.KillAll;
          vk_F2: LineGames.RunStep;
          VK_F4:
            begin
              if IsWindowVisible(hDlg) then
                showWindow(hDlg, SW_HIDE)
              else
                showWindow(hDlg, SW_SHOW);

            end;
        end;
        result := 0;
      end;

    WM_LBUTTONDOWN:
      begin
        //响应鼠标左键按下消息,若在标题栏内则使窗体移动
        pt.x := LOWORD(lParam);
        pt.y := HIWORD(lParam);
        if PtInRect(rcCaption, pt) then
          PostMessage(hDlg, WM_NCLBUTTONDOWN, HTCAPTION, 0);
      end;
    WM_PAINT:
      begin
        //响应绘制消息,绘制标题栏
        h_DC := BeginPaint(hDlg, ps);
        PaintCaption(h_DC, h_Icon, szMainCaption, rcCaption, clFrom, clTo);
        EndPaint(hDlg, ps);
      end;

    WM_COMMAND:
      begin
        case wParam of
          MAIN_SINGLE:
            begin
              LineGames.RunStep;
            end;
          MAIN_ALL: LineGames.KillAll();
          MAIN_OPTION: DialogBox(h_Inst, LPCTSTR(IDD_OPTIONDLG), hDlg,
              @OptionProc);
          MAIN_ABOUT:
            DialogBox(h_Inst, LPCTSTR(IDD_ABOUTDLG), hDlg, @AboutProc);

          MAIN_EXIT: EndDialog(hDlg, 0);
        end;
        result := 0;
      end;
    WM_DRAWITEM:
      begin
        pdis := PDRAWITEMSTRUCT(lParam);
        DrawButton(pdis);
        Result := 0;
      end;
    WM_TIMER:
      begin
        //定时器触发时移动子窗体,形成字幕
        if g_AutoStart then
          LineGames.AutoStart;
        if g_Computer then
          LineGames.RunStep;

        if g_Random then
        SetTimer(hDlg,169,500+Random(g_internal-500),nil);
      end;
    ///////////////////////////////////////////////////
    //响应绘制窗体内容消息
    WM_CTLCOLORDLG:
      begin
        SetTextColor(wParam, clText);
        SetBkMode(wParam, TRANSPARENT);
        Result := BKC;
      end;
    WM_CTLCOLORSTATIC:
      begin
        SetTextColor(wParam, clText);
        SetBkMode(wParam, TRANSPARENT);
        Result := BKC;
      end;
    WM_DESTROY:
      begin
        UnregisterHotKey(hDlg, ID_HOTKEYF2); //用完记得要收回
        UnregisterHotKey(hDlg, ID_HOTKEYF3); //用完记得要收回
        UnregisterHotKey(hDlg, ID_HOTKEYCTRLF4); //用完记得要收回
        KillTimer(hDlg, 169);
        PostQuitMessage(0);
      end;
  else
    Result := 0;
  end;
end;
//////////////////////////////////////////////////////////////////
//程序入口函数
//
begin
  h_Inst := GetModuleHandle(nil); //保存实例句柄
  BKC := CreateSolidBrush(clBackground); //建立背景画刷
  //h_Cur := LoadCursor(h_Inst, LPCTSTR(IDC_HAND)); //载入鼠标指针
  h_Icon := LoadIcon(h_Inst, LPCTSTR(MAINICON)); //载入程序图标


  //显示协议对话框
  LineGames := TLineGame.Create;

  DialogBox(h_Inst, LPCTSTR(IDD_MAINDLG), 0, @MainProc);
  LineGames.Free;
  DeleteObject(BKC); //释放背景画刷
  //退出程序
  ExitProcess(0);
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -