C
ch_yahuu
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> ExtCtrls, StdCtrls, Buttons;<br><br>type<br> TForm1 = class(TForm)<br> BitBtn1: TBitBtn;<br> BitBtn2: TBitBtn;<br> procedure BitBtn1Click(Sender: TObject);<br> procedure BitBtn2Click(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.BitBtn1Click(Sender: TObject);<br>begin<br>if findwindow('#32770',nil)<>0 then//我早找出他的类名了。<br>showmessage('oicq is running!')<br>else<br>showmessage('oicq is not running!');<br>end;<br>//上面的代码均成功。。但是下面要关它的时候,却关不了。。是不是窗口句柄找错了,但我找了多少次都是这一个。<br>没有办法了,只好贴出来由大家解决了。。。。<br>procedure TForm1.BitBtn2Click(Sender: TObject);<br>var cl:hwnd;<br>begin<br>cl:=findwindow('#32770',nil);<br>sendmessage(cl,wm_close,0,0);<br>end;<br><br>end.<br>