When I run the terminate command on a com.sun.star.frame.Desktop object, the office task remains running in the background and can be seen on the windows task manager. The following is the most simple version of the code i'm using to replicate this.
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
ooServiceManager, ooDesktop: Variant;
begin
ooServiceManager := CreateOleObject('com.sun.star.ServiceManager');
ooDesktop := ooServiceManager.CreateInstance('com.sun.star.frame.Desktop');
ooDesktop.Terminate;
end;
Code: Select all
ShellExecute(0, nil, 'c:\windows\system32\taskkill.exe', '/F /iM soffice.bin', nil, SW_HIDE);
How do I terminate the office task using the service manager or desktop?