CreateProcess() came up a few times searching google….
Is it OK to assume this is the safest and most efficient method?
If so, I would like to use the output of the called process.
How do I know it has completed before continuing on in the C program?
Thanks.
ShellExecute Can be used to create a process, its a more convenient way to pass arguments.
But if you want to use the output of the process then
CreateProcessis probably your best betWith
CreateProcessyou can pass a STARTUPINFO structure that can be used to pass a file pipe handle to Standard Out of the process.CreateProcesswill return a PROCESS_INFORMATION structure containing a HANDLE to the created process. That handle will become signalled when the process exits.So You can WaitForSingleObject on the process handle to wait for the output to be complete.
Don’t forget to
CloseHandleon the process handle and thread handle when you are done.