Killing the process
-
How will I kill all the spawned processes of my application? I dont want to kill my main application, but only the all other processes spawned by my main application? Is there any articles related to this? Thanks, Stanly
-
When u spawn a process using CreateProcess() u will get the preocss handle of the new process. Store that handle in a Vaiable. So when u want to Kill the spawned preocess, call TerminateProcess() with that handle. nave
The problem with me is that, I'm spawning many process. One process my spawn other process. So my spawned process is having many other spawns. But when I'm terminating the main spawned process, only that process is terminated, not the child processes. I want to implement Kill Process Tree function for my child processes. Thanks, Stanly
-
The problem with me is that, I'm spawning many process. One process my spawn other process. So my spawned process is having many other spawns. But when I'm terminating the main spawned process, only that process is terminated, not the child processes. I want to implement Kill Process Tree function for my child processes. Thanks, Stanly
-
if all the process u create have window( or create a message only window), u can send the WM_CLOSE message to all the child process. When a WM_CLOSE message arrives, let it send the WM_CLOSE message to its child process and so on... nave
This solution won't work for me because I won't be able to keep track of all spawned windows/applications. Spawned application say MS SQL query analyzer is not created by me. So, that application may spawn other applications. I want to implement the function of Kill Process tree just like in Process Explorer by Mark Russinovich (www.sysinternals.com). Thanks, Stanly
-
This solution won't work for me because I won't be able to keep track of all spawned windows/applications. Spawned application say MS SQL query analyzer is not created by me. So, that application may spawn other applications. I want to implement the function of Kill Process tree just like in Process Explorer by Mark Russinovich (www.sysinternals.com). Thanks, Stanly
stanlymt wrote:
This solution won't work for me because I won't be able to keep track of all spawned windows/applications. Spawned application say MS SQL query analyzer is not created by me. So, that application may spawn other applications.
You are doomed!
-
How will I kill all the spawned processes of my application? I dont want to kill my main application, but only the all other processes spawned by my main application? Is there any articles related to this? Thanks, Stanly
Terminating process, especially processes you didn't even write, is asking for trouble. Here's a quote from MSDN: "The TerminateProcess function is used to unconditionally cause a process to exit. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used" The fact that terminating a process is not safe is obvious if you think about it: The process may be in the middle of doing something like updating a file and suddenly it's killed without getting a chance to do any cleanup. This could quite obviously lead to data corruption for example.
TerminateProcess
is meant as a last resort like when like you have to kill a misbehaving and non-responsive process with task manager. Steve -
This solution won't work for me because I won't be able to keep track of all spawned windows/applications. Spawned application say MS SQL query analyzer is not created by me. So, that application may spawn other applications. I want to implement the function of Kill Process tree just like in Process Explorer by Mark Russinovich (www.sysinternals.com). Thanks, Stanly
Take a look at the
Process32First()
/Process32Next()
pair.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
-
How will I kill all the spawned processes of my application? I dont want to kill my main application, but only the all other processes spawned by my main application? Is there any articles related to this? Thanks, Stanly
stanlymt wrote:
How will I kill all the spawned processes of my application? I dont want to kill my main application, but only the all other processes spawned by my main application? Is there any articles related to this?
look at CreateToolhelp32Snapshot and related api:)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You