[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

KILLING A PROCESS in VC++

Posted on 1998-05-12
6
Medium Priority
?
1,096 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 300 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

656 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