Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2006

Tip: Looking for answers? Try searching our database.

System.Diagnostic.Process

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Guest - 20 Jul 2006 00:11 GMT
Does anyone know the best way to interact with a command application using
System.Diagnostic.Process if the command application never exits?

In other words, The OnOutputRecieved event doesn't fire until the app
exists, which is not too helpful because I want to interact with the app
while it's running.

Here's my code:

           // Set UseShellExecute to false for redirection
           _proc.StartInfo.UseShellExecute = false;
           _proc.EnableRaisingEvents = true;

           // Redirect the standard output of the command.  
           // This stream is read asynchronously using an event handler.
           _proc.StartInfo.RedirectStandardOutput = true;

           _proc.StartInfo.RedirectStandardError = redirectStandardError;

           // Redirect standard input as well.  This stream
           // is used synchronously.
           _proc.StartInfo.RedirectStandardInput = true;

           _proc.StartInfo.CreateNoWindow = true;
           _proc.StartInfo.WorkingDirectory = somePathISpecified;
           _proc.StartInfo.FileName = commandPath;
           _proc.StartInfo.Arguments = arguments;
           _proc.Start();

           // Start the asynchronous read of the output stream.
           _proc.BeginOutputReadLine();

Now, this works fine if it's not a blocking process, but reading output, and
passing input doesn't seem to work if the process doesn't exit.

Thanks for any help
Guest - 20 Jul 2006 00:23 GMT
I found this article that looks like it'll be a big help if anyone else runs
into this:

http://www.codeproject.com/csharp/LaunchProcess.asp

> Does anyone know the best way to interact with a command application using
> System.Diagnostic.Process if the command application never exits?
[quoted text clipped - 32 lines]
>
> Thanks for any help

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.