Hello all.

I have an application that i am writing to automate an older system. The
system is based on a 16-bit DOS application. It apears to me that I am
unable to redirect input and output to and from the application. Does
anybody know if i am missing something simple?

Thanks

Re: Process.RedirectStandardInput Question by Greg

Greg
Tue Jun 29 17:27:44 CDT 2004

well there are a few things that could be happenning ... can you put up your
code ?
"Matt Osborne" <private@stupidSpamer.net> wrote in message
news:4XlEc.4710$HB7.1378@newssvr27.news.prodigy.com...
> Hello all.
>
> I have an application that i am writing to automate an older system. The
> system is based on a 16-bit DOS application. It apears to me that I am
> unable to redirect input and output to and from the application. Does
> anybody know if i am missing something simple?
>
> Thanks
>
>



Re: Process.RedirectStandardInput Question by Matt

Matt
Tue Jun 29 17:37:47 CDT 2004

Sorry, here is the code

ProcessStartInfo startInfo = new ProcessStartInfo( "snap2.pif", "" );
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardOutput = true;
startInfo.UseShellExecute = false;

Thread.Sleep( 1000 );

Process snapToIt = Process.Start( startInfo );

StreamWriter writer = snapToIt.StandardInput;
StreamReader reader = snapToIt.StandardOutput;

writer = new StreamWriter( writer.BaseStream, new
System.Text.ASCIIEncoding() );

writer.AutoFlush = true;
writer.Write( (byte)'x' );
writer.Write( (byte)'x' );
writer.Write( (byte)'x' );
writer.Write( (byte)'x' );
writer.Write( (byte)13 );
writer.Write( (byte)'s' );
writer.Write( (byte)'i' );
writer.Write( (byte)'=' );
writer.Write( (byte)'p' );
writer.Write( (byte)'r' );
writer.Write( (byte)'o' );
writer.Write( (byte)'d' );
writer.Write( (byte)13 );
writer.Write( (byte)13 );
writer.Write( (char)121 );

As you can see i have tried using bytes instead of chars to be "more 16 bit
compliant" but to no avail. I also have tried changing the formatter to be
ascii and that hasn't helped.

Thanks for the help


"Greg Young" <greg.young@planetbeach.com> wrote in message
news:%23rcVBfiXEHA.212@TK2MSFTNGP12.phx.gbl...
> well there are a few things that could be happenning ... can you put up
your
> code ?
> "Matt Osborne" <private@stupidSpamer.net> wrote in message
> news:4XlEc.4710$HB7.1378@newssvr27.news.prodigy.com...
> > Hello all.
> >
> > I have an application that i am writing to automate an older system.
The
> > system is based on a 16-bit DOS application. It apears to me that I am
> > unable to redirect input and output to and from the application. Does
> > anybody know if i am missing something simple?
> >
> > Thanks
> >
> >
>
>



Re: Process.RedirectStandardInput Question by Shakir

Shakir
Tue Jun 29 23:36:24 CDT 2004

Try this

pDOSProcess.StartInfo.RedirectStandardOutput = true;
pDOSProcess.StartInfo.CreateNoWindow = true;
pDOSProcess.EnableRaisingEvents = true;
pDOSProcess.StartInfo.UseShellExecute = false;
//Add the exited event
pDOSProcess.Exited += new EventHandler(Process_exited);

pDOSProcess.Start();


private void Process_exited(object sender, System.EventArgs ea)
{
Process pro = (Process)sender;
//get the output.
string stdout= pro.StandardOutput.ReadToEnd();
}

--
Shak
(Houston)


"Matt Osborne" <private@stupidSpamer.net> wrote in message
news:4XlEc.4710$HB7.1378@newssvr27.news.prodigy.com...
> Hello all.
>
> I have an application that i am writing to automate an older system. The
> system is based on a 16-bit DOS application. It apears to me that I am
> unable to redirect input and output to and from the application. Does
> anybody know if i am missing something simple?
>
> Thanks
>
>



Re: Process.RedirectStandardInput Question by Matt

Matt
Wed Jun 30 12:14:12 CDT 2004

Thanks for your post.

I tried your suggestion to no avail. To let you know more, I tried what i
had spawning "cmd" instead of my target app and i get a console window with
no output and i am able to read and write to its standard input and output
with out any problems. With this app I still can see the out put and it
apears that it is not recieving any input and when i manualy try to input
data it does not work either.

Any Ideas? The only think i can think of is that it doesn't work on 16 bit
applications

"David Williams" <DavidWilliams@discussions.microsoft.com> wrote in message
news:A2B83796-CCB5-489C-B61C-42A629B595A9@microsoft.com...
> Try this instead (typed here so watch typos):
>
> ProcessStartInfo startInfo = new ProcessStartInfo("snap2.pif", "");
> startInfo.RedirectStandardInput = true;
> startInfo.RedirectStandardOutput = true;
> startInfo.RedirectStandardError = true;
> startInfo.UseShellExcute = false;
> ThreadPool.QueueUserWorkItem(new WaitCallback(input));
> ThreadPool.QueueUserWorkItem(new WaitCallback(output));
> ThreadPool.QueueUserWorkItem(new WaitCallback(errors));
> Process snapToIt = Process.Start(startInfo);
> Process.WaitForExit();
>
> ...
>
> static void input(Object state)
> {
> StreamWriter writer = snapToIt.StandardInput;
> writer.AutoFlush = true;
> ...
> }
>
> static void output(Object state)
> {
> StreamReader reader = snapToIt.StandardOuput;
> reader.ReadToEnd();
> ....
> }
>
> static void errors(Object state)
> {
> StreamReader reader = snapToIt.StandardError;
> reader.ReadToEnd();
> ...
> }
>
>
> HTH
> --
> David Williams, VB.NET MVP
>
>
> "Matt Osborne" wrote:
>
> > Sorry, here is the code
> >
> > ProcessStartInfo startInfo = new ProcessStartInfo( "snap2.pif",
"" );
> > startInfo.RedirectStandardInput = true;
> > startInfo.RedirectStandardOutput = true;
> > startInfo.UseShellExecute = false;
> >
> > Thread.Sleep( 1000 );
> >
> > Process snapToIt = Process.Start( startInfo );
> >
> > StreamWriter writer = snapToIt.StandardInput;
> > StreamReader reader = snapToIt.StandardOutput;
> >
> > writer = new StreamWriter( writer.BaseStream, new
> > System.Text.ASCIIEncoding() );
> >
> > writer.AutoFlush = true;
> > writer.Write( (byte)'x' );
> > writer.Write( (byte)'x' );
> > writer.Write( (byte)'x' );
> > writer.Write( (byte)'x' );
> > writer.Write( (byte)13 );
> > writer.Write( (byte)'s' );
> > writer.Write( (byte)'i' );
> > writer.Write( (byte)'=' );
> > writer.Write( (byte)'p' );
> > writer.Write( (byte)'r' );
> > writer.Write( (byte)'o' );
> > writer.Write( (byte)'d' );
> > writer.Write( (byte)13 );
> > writer.Write( (byte)13 );
> > writer.Write( (char)121 );
> >
> > As you can see i have tried using bytes instead of chars to be "more 16
bit
> > compliant" but to no avail. I also have tried changing the formatter to
be
> > ascii and that hasn't helped.
> >
> > Thanks for the help
> >
> >
> > "Greg Young" <greg.young@planetbeach.com> wrote in message
> > news:%23rcVBfiXEHA.212@TK2MSFTNGP12.phx.gbl...
> > > well there are a few things that could be happenning ... can you put
up
> > your
> > > code ?
> > > "Matt Osborne" <private@stupidSpamer.net> wrote in message
> > > news:4XlEc.4710$HB7.1378@newssvr27.news.prodigy.com...
> > > > Hello all.
> > > >
> > > > I have an application that i am writing to automate an older system.
> > The
> > > > system is based on a 16-bit DOS application. It apears to me that I
am
> > > > unable to redirect input and output to and from the application.
Does
> > > > anybody know if i am missing something simple?
> > > >
> > > > Thanks
> > > >
> > > >
> > >
> > >
> >
> >
> >