根据给出的类名或窗口标题名称取的该窗口的句柄<br>var<br> AHandle:THandle;<br>begin<br> AHandle:=FindWindow(nil,'我的电脑');<br> if AHandle<>0 then<br> begin<br> //To do add your code here<br> SendMessage(AHandle,WM_SYSCOMMAND,SC_CLOSE,0);<br> end;<br>end;<br><br>// TMyFrm=class(TForm)<br><br>var<br> AHandle:THandle;<br>begin<br> AHandle:=FindWindow(TMyFrm,nil);<br> if AHandle<>0 then<br> begin<br> //To do add your code here<br> SendMessage(AHandle,WM_SYSCOMMAND,SC_CLOSE,0);<br> end;<br>end;<br><br><br>FindwindowEx 同理只是多一点参数<br><br>