Hi,

In my program, I use the function CreateProcessA() and WaitForSingleObject()
to create a child process and wait it to finish. How do I keep track if the
child process has launched another process? Is there a process Group ID
(like in UNIX) I can use?

Thank you very much.

Paul

Re: How to track the child process's child process and wait it to finish? by andrea

andrea
Mon May 10 11:35:50 CDT 2004

here's what I personally used as solution.... and it's working yet not the
only solution.

the child will create a 'locked' file.

the monitoring app will monitor this way,
1) either in a polling manner every N time, if that give file exists and NOT
deletable, it's because the child process is running, if it doesnt exist or
the file could be successfully deleted, then the child process died abruptly
or didnt even load.
2) the second way is a non intensive monitoring thread.Windows provides with
a wonderful directory monitoring API called FindFirstChangeNotification(),
you'd use it in compination with for example WaitForSingleObject(), and it
will only return when a given event, such as a file was created or changed,
so in a non cpu intensive way, you'd check if that locked file was created
or deleted.


"paul" <paullee2000@hotmail.com> wrote in message
news:e2rNFqpNEHA.160@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> In my program, I use the function CreateProcessA() and
WaitForSingleObject()
> to create a child process and wait it to finish. How do I keep track if
the
> child process has launched another process? Is there a process Group ID
> (like in UNIX) I can use?
>
> Thank you very much.
>
> Paul
>
>



Re: How to track the child process's child process and wait it to finish? by William

William
Mon May 10 12:25:31 CDT 2004

"paul" <paullee2000@hotmail.com> wrote in message
news:e2rNFqpNEHA.160@TK2MSFTNGP10.phx.gbl...
> In my program, I use the function CreateProcessA() and
WaitForSingleObject()
> to create a child process and wait it to finish. How do I keep track if
the
> child process has launched another process? Is there a process Group ID
> (like in UNIX) I can use?

Well, while there isn't any _exact_ mapping of 'nix group and Win32 job, you
might be able to cook up something.

The QueryInformationJobObject() will let you query a job for its constituent
process IDs while CreateJobObject() and AssignProcessToJobObject() will give
you something like a group. Take a look at this link for a good overview:


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/job_objects.asp

Regards,
Will



Re: How to track the child process's child process and wait it to finish? by paul

paul
Mon May 10 12:54:48 CDT 2004


"andrea catto'" <acatto@dataflight.com> wrote in message
news:%23ZIOXzqNEHA.2488@TK2MSFTNGP10.phx.gbl...
> here's what I personally used as solution.... and it's working yet not the
> only solution.
>
> the child will create a 'locked' file.

I might not make my question clear: in general, I don't have any
information about the process created by the child process except it is
launched from my child process.



Re: How to track the child process's child process and wait it to finish? by paul

paul
Mon May 10 13:32:37 CDT 2004

Thanks Will - I think that is what I am looking for. I thought some thing
was introduced in Windows 2000, but I couldn't recall what was.

Paul

"William DePalo [MVP VC++]" <willd.no.spam@mvps.org> wrote in message
news:eRvvJPrNEHA.620@TK2MSFTNGP10.phx.gbl...
> "paul" <paullee2000@hotmail.com> wrote in message
> news:e2rNFqpNEHA.160@TK2MSFTNGP10.phx.gbl...
> > In my program, I use the function CreateProcessA() and
> WaitForSingleObject()
> > to create a child process and wait it to finish. How do I keep track if
> the
> > child process has launched another process? Is there a process Group ID
> > (like in UNIX) I can use?
>
> Well, while there isn't any _exact_ mapping of 'nix group and Win32 job,
you
> might be able to cook up something.
>
> The QueryInformationJobObject() will let you query a job for its
constituent
> process IDs while CreateJobObject() and AssignProcessToJobObject() will
give
> you something like a group. Take a look at this link for a good overview:
>
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/job_objects.asp
>
> Regards,
> Will
>
>