SChatel
asked on
Kill process under Windows NT
How can I kill the Windows process "excel.exe" in Delphi ?
This will close Excel nicely, asking the user if they wish to save any changes (if it's relevant.)
SendMessage(FindWindow('XL MAIN', nil), WM_CLOSE, 0, 0);
Hope this helps,
John.
SendMessage(FindWindow('XL
Hope this helps,
John.
;-)
go to dos prompt and just say:
kill -f excel.exe
and all instances of excel will be killed, file open or not, regardlessly of any losses...
nice tool, that kill...
bye,
BlackDeath.
go to dos prompt and just say:
kill -f excel.exe
and all instances of excel will be killed, file open or not, regardlessly of any losses...
nice tool, that kill...
bye,
BlackDeath.
ASKER
Jaymol,
It works but only if I close my Delphi application
It works but only if I close my Delphi application
eh - for use in delphi use API-function ShellExecute or ShellExecuteEx, as you like.
and if you want excel to ask you, if the changes should be saved - well, then use
kill excel.exe
with out -f (stands for "force")
kill.exe ist part of the resource kit for windows you can download.
BD.
kill excel.exe
with out -f (stands for "force")
kill.exe ist part of the resource kit for windows you can download.
BD.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
procedure TForm1.Button1Click(Sender
var
Excel: Variant;
begin
try
Excel := GetActiveOleObject('Excel.
except
Excel := CreateOleObject('Excel.App
end;
Excel.DisplayAlerts := False;
Excel.Quit;
Excel := Unassigned;
end;