Home All Groups Group Topic Archive Search About

Capture cmd line traffic for windows application

Author
25 Mar 2005 9:09 PM
thompson_38
I have a COM object that wraps a console application.  This console app
outputs strings, using tprintf statements, throughout execution.  I
would like to capture that output from the console app and display it
in my C# Windows.Forms test application. I have tried StreamWriter,
StringWriter, OpenStandardOutput, but I only get empty strings
returned.  I do not want to change the console application nor the COM
app. I am still investigating, and if I find the answer I will be sure
to post it.  Thanks for your help in advance.

Author
26 Mar 2005 3:30 AM
Landi
Thompson_38,
I think this is the exact answer to what you are trying to do.
http://radio.weblogs.com/0111551/stories/2002/10/11/runASecondConsoleAppAndReadItsOutput.html

--
i***@dowhileloop.com
http://dowhileloop.com website development
http://publicjoe.dowhileloop.com -- C# Tutorials

Show quote
"thompson_38" <thompson***@hotmail.com> wrote in message
news:1111784964.474075.303520@z14g2000cwz.googlegroups.com...
> I have a COM object that wraps a console application.  This console app
> outputs strings, using tprintf statements, throughout execution.  I
> would like to capture that output from the console app and display it
> in my C# Windows.Forms test application. I have tried StreamWriter,
> StringWriter, OpenStandardOutput, but I only get empty strings
> returned.  I do not want to change the console application nor the COM
> app. I am still investigating, and if I find the answer I will be sure
> to post it.  Thanks for your help in advance.
>
Author
26 Mar 2005 10:37 AM
Willy Denoyette [MVP]
"Landi" <i***@dowhileloop.com> wrote in message
news:eHjCaQbMFHA.244@TK2MSFTNGP12.phx.gbl...
> Thompson_38,
> I think this is the exact answer to what you are trying to do.
> http://radio.weblogs.com/0111551/stories/2002/10/11/runASecondConsoleAppAndReadItsOutput.html
>
> --

The sample in the link only works if you start the console application from
another C# program, which is not OP's scenario.

Willy.
Author
28 Mar 2005 1:01 PM
thompson_38
Thank you for the information, I had tried the
http://radio.weblogs.com/01115­51/stories/2002/10/11/runASeco­ndConsole....
, but the exe is not being called directly.  I am sorry for the lack of
information, this is a C# windows test application the instantiates the
COM object.  The COM object is a wrapper for the C++ console
application.  The StreamWriter, StringWriter  are being used in the
Test applications, not in either the COM object nor the C++ console
application.
Author
26 Mar 2005 10:35 AM
Willy Denoyette [MVP]
"thompson_38" <thompson***@hotmail.com> wrote in message
news:1111784964.474075.303520@z14g2000cwz.googlegroups.com...
>I have a COM object that wraps a console application.  This console app
> outputs strings, using tprintf statements, throughout execution.  I
> would like to capture that output from the console app and display it
> in my C# Windows.Forms test application. I have tried StreamWriter,
> StringWriter, OpenStandardOutput, but I only get empty strings
> returned.  I do not want to change the console application nor the COM
> app. I am still investigating, and if I find the answer I will be sure
> to post it.  Thanks for your help in advance.
>

I'm not clear on what you mean by 'I don't want to change the console
application', where did you put the StreamWriter, StringWriter ... then?

Willy.

AddThis Social Bookmark Button