Creating a Child Process with access to Standard Out, Standard In, and Standard Error

P

patrick.ohara

I have look over the Process class in CF v2.0. I understand that I
can set UseShellExecute in ProcessStartInfo false and the created
process will share my console (STDIN, STDOUT, STDERR). This may work,
but what I would like to do is create a child process with its own
console, and with a set of pipes to its console. I looked at using
the Win32 API CreateProcess, on the desktop I could use the handles in
the STARTUPINFO structure. On Windows CE this property is not
supported. Does anyone have an idea of how this could be
accomplished.

Pat O
 
P

Paul G. Tobey [eMVP]

If you want to set up the standard I/O devices for a new program, what you
do is call SetStdioPathW for each of the standard devices in the launcher
program that you're writing, then call CreateProcess to launch the program
that you want to have use those devices, then you call SetStdioPathW to
reset the original devices in your calling program. SetStdioPathW is
documented in the native code SDK help...

Paul T.
 
P

patrick.ohara

If you want to set up the standard I/O devices for a new program, what you
do is call SetStdioPathW for each of the standard devices in the launcher
program that you're writing, then call CreateProcess to launch the program
that you want to have use those devices, then you call SetStdioPathW to
reset the original devices in your calling program. SetStdioPathW is
documented in the native code SDK help...

Paul T.

Thanks Paul,
Sometimes we just try to make things too difficult :). Now the
question is how do I setup a pipe so that I can set the console in the
child process to something the parent will also have access too.

Pat O
 
P

Paul G. Tobey [eMVP]

You might want to try to find the source for the MS-DOS program from Windows
CE and see what it does when it forks to another program that is being run
from the command line there. I think you want to do the same thing.

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top