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

  • 相关阅读:
    Maven入门教程
    认识Java Core和Heap Dump
    [Java IO]03_字符流
    Eclipse 实用技巧
    可变和不可变的区分
    什么猴子补丁待补充
    当退出python时,是否释放全部内存
    解释python中的help()和dir()函数
    在python中是如何管理内存的
    解释一下python中的继承
  • 原文地址:https://www.cnblogs.com/sunsoft/p/1964889.html
Copyright © 2011-2022 走看看