Before calling CreateProcess(), call SetStdioPathW() and point that to a
driver that you write and ActivateDevice() on. Come up with a means to get
the data sent to the driver from it (you might pass it a window handle to
which PostMessage() would be used, or you might specify that you'll send a
DeviceIoControl() to the driver to retrieve the data, or whatever you want).
So, your code might look like this, roughly:
// Turn on the driver that will get the stdout stuff.
ActivateDevice( <my device driver's register path> );
// Get the old setting for the current process' stdout driver.
GetStdioPathW( stdout, oldStdOut, ... )
// Change the stdout driver to the special driver.
SetStdioPathW( stdout, <the device name of my driver, something like STD0:,
maybe> );
// Start the process. It will inherit the stdout destination from us.
CreateProcess( <the program that you want to run> );
// Restore our own stdout destinaton.
SetStdioPathW( stdout, oldStdOut );
// What you do here depends on how the rest of the code is written, but you
might
// want to remember to deactivate the driver, wait for the other program to
exit, or
// any number of things.
So, you'll have to write a driver and several P/Invoke declarations, as well
as design a means to get the accumulated data from the driver...
Paul T.