Solved

KILLING A PROCESS in VC++

Posted on 1998-05-12
6
1,069 Views
Last Modified: 2013-12-03
I want to kill a concrete proccess but i don´t know which function i have to use. I´ll get the process PID but the kill call, does not exist (like it does in UNIX). Exist any function that realize the same function that kill call  do in UNIX?
How can i do that?
I hope somebody help me.
Thanks.
0
Comment
Question by:jgonzalez
  • 4
  • 2
6 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 1401272
Answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1401273
If you have to, you can use TerminateProcess() to kill a process.  However this is a last resort sort of measure.  It only does a partial cleanup.  If the process uses DLLs they may not be detached from the process and will continue to use resources until the system is rebooted.  

Dependong on what you want to do, there might be a better way.  What is it you want to do?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1401274
TerminateProcess uses a process handle.  If you have the process ID but not the handle, use OpenProcess() to get the handle.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:jgonzalez
ID: 1401275
I just have a bacht program in which is running a service program ( exe program), when i want to stop the services to update a data base, i´ll close ( by code) the bacht program but the service is still running( viewing the NT task manager), i want kill this program.
i use  the bacht program but in case of  service shutdown( by somethig "strange")  it starts himself again
0
 
LVL 22

Expert Comment

by:nietod
ID: 1401276
I don't understand your explanation completely.

However, there is probably a better way than TerminateProcess.  You could use an event (See CreateEvent()).  One program could signal the event when ot wants the  other program to terminate.  The other program terminates when it finds that the event is signaled.  
0
 

Author Comment

by:jgonzalez
ID: 1401277
OK the first way works fine.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

910 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

19 Experts available now in Live!

Get 1:1 Help Now