'Close Application'에 해당되는 글 1건

  1. 2007/09/19 How to Close Another Application by Windows Caption
2007/09/19 08:12

How to Close Another Application by Windows Caption

To programmatically close another application, send to the application a WM_QUIT message. "Window caption" is the caption of the window that you are sending the message to.

Usage:

if not KillApp('Window caption') then ShowMessage('App not closed') ;

Here's the source code can kill the application by windows caption.
function KillApp(const sCapt: PChar) : boolean;
  var AppHandle:THandle;
begin
  AppHandle:FindWindow(Nil, sCapt) ;
  Result:PostMessage(AppHandle, WM_QUIT, 0, 0) ;
end;
Trackback 0 Comment 0