tags:

views:

34

answers:

2

I am using CreateProcess function for creating the process, is there any option to get the current state of the process (running or not). Kindly guide me how can I make it possible.

+1  A: 

Use OpenProcess function with that dwProcessId if it returns NULL Process is not running otherwise it will return handle to that process

mihirpmehta
Why do you call OpenProcess? It only gives you another handle to the new process, as CreateProcess already returned one.
MSalters
I guess OpenProcess Will not create new process it will return handle only if that process is running (I am not sure...)
mihirpmehta
+1  A: 

Create process returns a handle to the process in PROCESS_INFORMATION structure, you can use this with something like GetExitCodeProcess to work out if it is still running, or you can use the wait functions to wait for it to exit.

tyranid