Solved

KILLING A PROCESS in VC++

Posted on 1998-05-12
6
1,071 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run Program using VBScript 3 65
how to bring to back always mid parent image form 21 81
dialer.exe 4 60
How can i Install a new Data Source on Visual Studio 2 99
This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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…

809 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