Hola. Mi nombre es Johan Hernandez y este es mi blog personal donde expreso mis ideas y opiniones. Si estas en busca de mi blog con temas de Tecnologia e Informatica este se encuentra en http://johansoft.blogspot.com.
Mi foto
Barranquilla, Atlantico, Colombia
Cross-Platform Developer

viernes, julio 4

Prueba de codigo

 

   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: