How to know the previous process whether exited? 
Author Message
 How to know the previous process whether exited?

Hi there,

CreateProcess will also return a HANDLE to the new process.
You can use one of the Wait* API's to wait for the process to finish like
this:

    HANDLE hChild = CreateProces(...)

    ... do some work...

    WaitForSingleObject(&hChild,...)

   If you want to get the Exit code of the child process, use

        GetExitCode(hChild)

Hope this helps,

James Wilkinson


Quote:
> Hi all:
>   I have ever launched a external program with CreateProcess(). I want to
> know the process that I launched before whether exited. The processID is
> returned in CreateProcess(). Could I conclude it according to searching if
> the ProcessID exist. Is there any API function which can search the
special
> ProcessID as FindWindow(). Any advice is appreciated very much.



Sat, 03 Aug 2002 03:00:00 GMT  
 How to know the previous process whether exited?
Greets,

    I was under the impression that CreateProcess() returns a boolean result
as to whether or not the call failed?  The handle to the process should be
retrieved from the PROCESS_INFORMATION structure.  It should be noted that
both the handle to the thread and process returned in this structure should
be closed when no longer needed.

Regards,

Joe


Quote:
> Hi there,

> CreateProcess will also return a HANDLE to the new process.
> You can use one of the Wait* API's to wait for the process to finish like
> this:

>     HANDLE hChild = CreateProces(...)

>     ... do some work...

>     WaitForSingleObject(&hChild,...)

>    If you want to get the Exit code of the child process, use

>         GetExitCode(hChild)

> Hope this helps,

> James Wilkinson



> > Hi all:
> >   I have ever launched a external program with CreateProcess(). I want
to
> > know the process that I launched before whether exited. The processID is
> > returned in CreateProcess(). Could I conclude it according to searching
if
> > the ProcessID exist. Is there any API function which can search the
> special
> > ProcessID as FindWindow(). Any advice is appreciated very much.



Sat, 03 Aug 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to know the previous process whether exited?

2. How to know the previous process whether exited?

3. How to know the previous process whether exited?

4. What type of error should I check to know whether database is corrupted or not

5. Need to know whether the focus window will ignore keyboard input

6. How to know whether i am connected

7. how to know whether i am connected

8. how do i know whether IIS is installed not

9. exit(1), exit(2), exit(3) ....???

10. Process.Exited event

11. Process.Exited Event

12. exiting a .NET/C# process

 

 
Powered by phpBB® Forum Software