-
September 17th, 2004, 06:57 AM
#1
Process Parent & Child
Is there away for a parent process to start a child process, and then the parent terminates but the child still remains, so it kind of detaches its self from the parent.
My child process will have the task of deleting the parent's executable, thats why I need to kill the parent but have the child alive, I can achive the following running a bat file with ShellExecute, but want to discard the bat file and do it with code instead, so its hidden.
Any Ideas?
-
September 17th, 2004, 07:24 AM
#2
Re: Process Parent & Child
Here is an Idea:
Is it necessary to have a parent child relationship?
Could one process simpley start another process by setting a flag somewhere?
ahoodin
-
September 17th, 2004, 07:52 AM
#3
Re: Process Parent & Child
Hi,
If you find below one is useful.. try it
Create a Process controller, It is a process which means to only to control lifetime of running process. Its shall launch and terminate child process.
Your current Parent Process shall notify to this controll process to create a child process. Now you have control with child process , it is no where related to lifetime of your earlier parent processs.
Use CreateProcess(), Exit Process().. Have a look at below link
http://msdn.microsoft.com/library/de...ateprocess.asp
-
September 19th, 2004, 04:31 AM
#4
Re: Process Parent & Child
Thanks for the replies guys.....
Is what I am trying to achieve....an application updater
My 'program.exe' needs to be updated by a new version called 'program_new.exe',
sp within 'program.exe' I need to close 'program.exe' down and replace it with 'program_new.exe' (then rename it to program.exe) then I want to re-run 'program.exe'.
I can achieve the above by running a bat file with ShellExecute but would prefer to do everything from within the code.
-
September 19th, 2004, 05:40 AM
#5
Re: Process Parent & Child
Ghm... Why do you think there is that strong link between processes? You can create child process and kill parent- and there would be no problem. Child process would run on. Or maybe there is some specific creation method that forces the thing you write to be? Anyway you can create second process using CreateProcess function and get rid of that obstacles.
"Programs must be written for people to read, and only incidentally for machines to execute."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|