zoukankan      html  css  js  c++  java
  • DELPHI QQ2008聊天内容获取

    unit Unit1;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;

    type
      TForm1 = class(TForm)
        Timer1: TTimer;
        Memo1: TMemo;
        Label1: TLabel;
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;
      Sign: string;
    implementation

    {$R *.dfm}

    procedure TForm1.Timer1Timer(Sender: TObject);
    var
      Title: array[0..255] of Char;
      QQText: Pchar;
      Long: Integer;
      hLastWin: THandle;
    begin
      try
        Timer1.Enabled := False;
        hLastWin := GetForegroundWindow;
        Getwindowtext(hLastWin, Title, 255); //获取窗口标题
        if (Pos('交谈中', Title) > 0) then
        begin
          hLastWin := FindWindowEx(hLastWin, THandle(nil), '#32770', nil);
          if hLastWin = 0 then Exit;
          hLastWin := FindWindowEx(hLastWin, THandle(nil), 'RichEdit20A', nil);
          if hLastWin = 0 then Exit;
          Long := SendMessage(hLastWin, WM_GETTEXT, 0, 0) + 1;
          GetMem(QQText, Long);
          SendMessage(hLastWin, WM_GETTEXT, Long, Integer(QQText));
        end else Exit;
        try
          if QQText <> '' then
          begin
            Memo1.Text := QQText;
          end;
        finally
          FreeMem(QQText);
        end;
      finally
        Timer1.Enabled := True;
      end;
    end;

    end.

    http://blog.sina.com.cn/s/blog_426a901f0100e5zr.html

  • 相关阅读:
    yii2增删改查及AR的理解
    yii2中关联查询
    yii2常用的migrate命令
    有线电视网
    选课
    没有上司的舞会
    [ZJOI2008]骑士
    【模板】树链剖分
    [ZJOI2008]树的统计
    [NOI2015]软件包管理器
  • 原文地址:https://www.cnblogs.com/sunsoft/p/1964889.html
Copyright © 2011-2022 走看看