Solved

Kill process under Windows NT

Posted on 2001-07-10
7
414 Views
Last Modified: 2010-04-06
How can I kill the Windows process "excel.exe" in Delphi ?
0
Comment
Question by:SChatel
7 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6269487
uses ComObj;

procedure TForm1.Button1Click(Sender: TObject);
var
  Excel: Variant;
begin
  try
    Excel := GetActiveOleObject('Excel.Application');
  except
    Excel := CreateOleObject('Excel.Application');
  end;
  Excel.DisplayAlerts := False;
  Excel.Quit;
  Excel := Unassigned;
end;
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 6269738
This will close Excel nicely, asking the user if they wish to save any changes (if it's relevant.)

  SendMessage(FindWindow('XLMAIN', nil), WM_CLOSE, 0, 0);

Hope this helps,

John.
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 6269887
;-)

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.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:SChatel
ID: 6269893
Jaymol,
It works but only if I close my Delphi application
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 6269895
eh - for use in delphi use API-function ShellExecute or ShellExecuteEx, as you like.
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 6269933
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.
0
 
LVL 21

Accepted Solution

by:
ziolko earned 50 total points
ID: 6272001
Check out my previouse Q:
/jsp/qManageQuestion.jsp?ta=delphi&qid=10372556
You can kill anything not only excel :-)))
ziolko/
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
APK file name 7 64
Delphi XE10, DigitalPersona Fingerprint reader and MySQL 6 173
Mydac connection data base issue 3 107
Magic Software info 18 105
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now