Solved

KILLING A PROCESS in VC++

Posted on 1998-05-12
6
1,067 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
Comment Utility
Answer coming.
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
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
Comment Utility
TerminateProcess uses a process handle.  If you have the process ID but not the handle, use OpenProcess() to get the handle.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:jgonzalez
Comment Utility
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
Comment Utility
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
Comment Utility
OK the first way works fine.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

9 Experts available now in Live!

Get 1:1 Help Now