Например, Блокнот можно закрыть так:
procedure TForm1.Button1Click(Sender: TObject);var phandle : HWND;begin phandle := FindWindow('Notepad', nil); if phandle = 0 then RaiseLastWin32Error; SendMessage(phandle, WM_CLOSE, 0, 0);end;