How to check if the process is closed?

I am writing a program in C ++. In my code, I start process A using the CreateProcess function. Process A starts another process B. B runs for a while and then closes. Runtime B depends on various parameters. Sometimes B runs for 1 hour, but sometimes for almost 2 hours. I need to know when B finished his work (when B is closed). How can I check the closing of the second program B? In other words, is there any function (e.g. in WINAPI) to check if a process is alive?

+4
source share
1 answer

Use WaitForSingleObject() , passing in the process descriptor.

+7
source

All Articles