1

The question here is if anyone has an idea how to both get StandardOutput data to print in Windows form application and keep the output in the console itself. The WinForms part I have completed already, it works great with process events and invoking form elements. At this point I am pretty sure that after re-directing output, Console.Writeline() doesn't print anything on the console window anymore. Any ideas besides running another dummy process that simply displays anything whats on InputStream?

Also

While I'm at this. Is there any way to access process that is on another thread? Since whenever I try to access it it shows that its out of scope.

Samuel Slade
  • 8,405
  • 6
  • 33
  • 55
TheBW
  • 1,405
  • 2
  • 11
  • 16
  • 1
    This is not trivial at all. You need to capture the output, and then print it back to the console and your TextBox. You need to handle backspace characters (tricky) and the console app positioning the cursor manually (extremely tricky). It's very unlikely that someone will have this code handy to give you here. – Roman Starkov Jan 09 '12 at 11:41
  • What console window? A Winforms project doesn't have a console window. It shouldn't anyway. You can reassign Console.Out with the SetOut() method. See http://stackoverflow.com/questions/2547428/net-console-textwriter-that-understands-indent-unindent-indentlevel – Hans Passant Jan 09 '12 at 14:40
  • What if I call new console applications that is cmd.exe and feed the output with @echo? – TheBW Jan 09 '12 at 15:14

0 Answers0