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

  • 相关阅读:
    主成分分析法(PCA)答疑
    搜索引擎的高级用法
    Makefile 编写实例
    GCC常用命令
    一个进程最多能开多少个线程?
    归并排序
    选择排序(数组、链表)
    求连续子数组的最大和
    生产者-消费者问题(1)
    基于cmake编译安装MySQL-5.5
  • 原文地址:https://www.cnblogs.com/sunsoft/p/1964889.html
Copyright © 2011-2022 走看看