Click to See Complete Forum and Search --> : Terminating another Process in WIn95/98/NT


Hernan
April 28th, 1999, 07:15 PM
Hi!

i want to terminate another process from my own process, how can i do that?
i want to do it under win95/98 and NT.

thanks in advance.

April 28th, 1999, 11:39 PM
You can OpenProcess(...) and use the Handle to TerminateProcess(...) or ExitProcess(...). mail me the result to dineshsv@hotmail.com

April 29th, 1999, 01:06 PM
Hi,
I strongly believe what you want to do is not such an easy task as dinesh had written. Its true that you have to use TerminateProcess() to kill another process. ExitProcess() is for terminating the application by itself. It can not terminate another application. TerminateProcess() has to use the Handle, but how to get the handle of other processes? You should have the ProcessId for that. Then the next question is how to get the ProcessID!! Haplessly there is no set of API's available common to Win NT4.0/95/98. In 95 and 98 you should use ToolHelp32 API's to get the ProcessId while in case of NT you should either use PDH(Performance Data Helper) APIs (I haven't used PDH APIs, but read about it in 98 Sept issue of MSJ) or Performance Monitoring feature of NT(Article by Jeffrey Richter in August issue of MSJ). I used the second method and succeeded to write a DLL which works fine for both NT and 95. According to Microsoft they hadn't time to incorporate ToolHelp32 APIs to NT4.0, but they have done it for 5.0/2000. If you send me your mail id I will send you the source code,
Ashley Antony
Ashley.Antony@in.bosch.com
Robert Bosch India Ltd,
Bangalore, India.