How to use win32 CreateProcess function to wait until the child done to write to file

user63898 picture user63898 · May 6, 2011 · Viewed 11.1k times · Source

Hello im not win32 programmer and its all new to me. i like to open process from my parent win32 application ( ok this is i know how to do) the child process then write to text file and close it self . how can i detect in the parent application that the child application done writing to the text file . and then from the parent app to read the text file . this is all in win32 c++ Thanks

Answer

Begemoth picture Begemoth · May 6, 2011

The PROCESS_INFORMATION structure (which is the last argument to CreateProcess) contains member hProcess. This is a handle to the new process, which you can wait on using WaitForSingleObject.