[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Process ID

Posted on 2000-01-28
7
Medium Priority
?
206 Views
Last Modified: 2010-04-04
How Can I shutdown some application
if I have it's process ID ???
0
Comment
Question by:zeko
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 5

Expert Comment

by:TheNeil
ID: 2396188
You could send it a WM_CLOSE message

The Neil
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2396342
Actually, Wm_Close assumes that you are trying to close a windowed application. If it were a service or a console application, WM_Close would not be the way to go. I'd suggest looking at TerminateProcess instead.

Good luck!!
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2396399
DrDelphi,

You're right - if my stupid brain was working I'd have remembered TerminateProcess

The Neil
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 20

Expert Comment

by:Madshi
ID: 2396473
zeko, use OpenProcess to obtain a process handle from the process ID, then call TerminateProcess with the process handle.

Regards, Madshi.

P.S: Something like this:

ph := OpenProcess(PROCESS_ALL_ACCESS, false, pid);
TerminateProcess(ph, 0);
0
 

Author Comment

by:zeko
ID: 2396624
Thanks Madshi
Post me an answer.
0
 
LVL 20

Accepted Solution

by:
Madshi earned 200 total points
ID: 2396632
Dr. Delphi, The Neil, is that okay for you?

zeko, you can accept my comment as the answer (see the link in the top right corner of the comments).
0
 

Author Comment

by:zeko
ID: 2397174
You posted me the full source code.
You earned it.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

613 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