unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, ExtCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Timer1: TTimer;<br> procedure Timer1Timer(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>var<br> hMemo, HWindow,: THandle; //句柄变量<br> szText : Array[0..255] Of char; //得到的字符串<br> MyText : String; //发送的字符串<br>Begin<br> HWindow := 0;//从零开始,即从第一个字窗体开始遍历查找<br><br><br><br> While true Do<br> Begin<br><br><br><br> //找是#32770(对话框)的窗体<br> HWindow := FindWindowEx(0, HWindow, '#32770', Nil);<br> If HWindow <> 0 Then<br> Begin<br><br><br> hRichEdit := FindWindowEx(hwindow, 0, 'button', '登录');<br> If hRichEdit <> 0 Then<br> Begin<br>if hRichEdit<>0 then<br>begin<br>senmessage(HWindow,wm_close,0,0);//关QQ<br>end;<br><br><br><br> End;<br> End;<br><br> end;<br><br>end.<br><br><br>可能有错........我刚刚写的.