How can I kill a Process??
-
Hi, I am stuck up in the middle of killing a process created using CreateProcess within a DLL. While using ExitProcess with the crated process's exitcode, it is terminating the parent process too. Is there anyway to kill a process created within a DLL without disturbing the parent process??:confused:. BTW the process that is craeted is an exe file of a console application. thanks, -Pav. Got it, nevermind by using terminate process with process handle that was created;P ;) -- modified at 18:06 Wednesday 5th April, 2006
-
Hi, I am stuck up in the middle of killing a process created using CreateProcess within a DLL. While using ExitProcess with the crated process's exitcode, it is terminating the parent process too. Is there anyway to kill a process created within a DLL without disturbing the parent process??:confused:. BTW the process that is craeted is an exe file of a console application. thanks, -Pav. Got it, nevermind by using terminate process with process handle that was created;P ;) -- modified at 18:06 Wednesday 5th April, 2006
well you should do it with terminate process but when opening the process and obtaining the handle you should open it without inheritting from parrent. OpenProcess( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId ); DediredAccess should be PROCESS_TERMINATE and bInheritHandle should be FALSE Then terminateprocess should do the job easily; gabby
-
well you should do it with terminate process but when opening the process and obtaining the handle you should open it without inheritting from parrent. OpenProcess( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId ); DediredAccess should be PROCESS_TERMINATE and bInheritHandle should be FALSE Then terminateprocess should do the job easily; gabby
OpenProcess hmmm... will give it a try sometime... Thanks for your time though.. -Pav
-
Hi, I am stuck up in the middle of killing a process created using CreateProcess within a DLL. While using ExitProcess with the crated process's exitcode, it is terminating the parent process too. Is there anyway to kill a process created within a DLL without disturbing the parent process??:confused:. BTW the process that is craeted is an exe file of a console application. thanks, -Pav. Got it, nevermind by using terminate process with process handle that was created;P ;) -- modified at 18:06 Wednesday 5th April, 2006
Although the practice is rampart - in general it is not safe to go around calling
TerminateProcess
on processes. This API kills the process on the spot and as such the application doesn't have a chance to clean up after itself. For example it may result in temporary files not being deleted, files or registry entries in a corrupt state as a result of the process being terminated in the middle of an update or worse. Steve -
Although the practice is rampart - in general it is not safe to go around calling
TerminateProcess
on processes. This API kills the process on the spot and as such the application doesn't have a chance to clean up after itself. For example it may result in temporary files not being deleted, files or registry entries in a corrupt state as a result of the process being terminated in the middle of an update or worse. SteveYep, you are right. But, depending upon the application I think we can go in this way :) to get around the problem. But in intensive applications this is not something that is recommended as you said. But, for me, this is good enough as I am using to start and stop NI-Board. -Pav
-
Hi, I am stuck up in the middle of killing a process created using CreateProcess within a DLL. While using ExitProcess with the crated process's exitcode, it is terminating the parent process too. Is there anyway to kill a process created within a DLL without disturbing the parent process??:confused:. BTW the process that is craeted is an exe file of a console application. thanks, -Pav. Got it, nevermind by using terminate process with process handle that was created;P ;) -- modified at 18:06 Wednesday 5th April, 2006
Hi pavanbabut, maybe it is some helpful to you http://www.codeproject.com/threads/killprocess.asp[^]