To close another application from Delphi program send to that
application's main window WM_CLOSE message (PostMessage API declared in
the Windows unit). You must pass the handle of the window to which you
want to post the message. This handle you can obtain by using the
FindWindow API (also declared in the Windows unit).
uses Windows, Messages;
procedure TForm1.Button1Click(Sender: TObject);
var
h: HWND;
begin
h := FindWindow(nil,
'Caption-of-the-main-form-of-app-you-want-to-close');
if h <> 0
then PostMessage(h, WM_CLOSE, 0, 0);
end;
Cheers,
Danijel Tkalcec