Help with running and controlling other application from a form  
Author Message
Aamer





PostPosted: Visual C# Language, Help with running and controlling other application from a form Top

Hi all

I am working on a C# project and i need two things...

1--- I want another text editor to open a file but want to keep that editor window under

my form control i.e. as child.... How can I do this

2--- I want to open a command line window (cmd window through a .bat file) and then execute some commands on that but from my windows form... how can i do this. I also want to capture output of the command window after it runns my commands..

Please help

Aamer



Visual C#1  
 
 
TaylorMichaelL





PostPosted: Visual C# Language, Help with running and controlling other application from a form Top

In both cases use Process.Start to create another process. In the first case you'll point it to the text editor and let it go. In the second case you'll use ProcessStartInfo and point it to cmd.exe and use the command parameters to tell it to run the batch file. To redirect the output you need to set the Redirect... properties. This can be tricky (and was really difficult in v1.x) so look at the example in MSDN for the property on how to do this properly without deadlocking the process.

Michael Taylor - 12/6/06