1: private void Form1_Load(object sender, EventArgs e)
2: {
3: ProcessStartInfo si = new ProcessStartInfo(@"C:\Users\Johan Hernandez\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe");
4: si.RedirectStandardOutput = true;
5: si.UseShellExecute = false;
6: Process p = Process.Start(si);
7: ThreadPool.QueueUserWorkItem(delegate
8: {
9: char c = char.MinValue;
10: while ((c = (char)p.StandardOutput.Read()) != 0)
11: {
12: if (this.InvokeRequired)
13: this.Invoke(new EventHandler(delegate
14: {
15: this.textBox1.AppendText(c.ToString());
16: }));
17: else
18: {
19: this.textBox1.AppendText(c.ToString());
20: }
21: }
22: });
23:
24: }
1: private void Form1_Load(object sender, EventArgs e)
2: {
3: ProcessStartInfo si = new ProcessStartInfo(@"C:\Users\Johan Hernandez\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe");
4: si.RedirectStandardOutput = true;
5: si.UseShellExecute = false;
6: Process p = Process.Start(si);
7: ThreadPool.QueueUserWorkItem(delegate
8: {
9: char c = char.MinValue;
10: while ((c = (char)p.StandardOutput.Read()) != 0)
11: {
12: if (this.InvokeRequired)
13: this.Invoke(new EventHandler(delegate
14: {
15: this.textBox1.AppendText(c.ToString());
16: }));
17: else
18: {
19: this.textBox1.AppendText(c.ToString());
20: }
21: }
22: });
23:
24: }
No hay comentarios:
Publicar un comentario