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 CreateProcess
is probably your best bet
With CreateProcess
you can pass a STARTUPINFO structure that can be used to pass a file pipe handle to Standard Out of the process.
CreateProcess
will 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 CloseHandle
on the process handle and thread handle when you are done.