title: Reading all output lines of a console application working from a win32 application using C#
body: <p>I have a win32 application and I start a console application using the following code:</p>
  
  <pre><code>public void ExecuteDecript(int element)
  {
      string toquen = TaskList[element].MakeToquen();
      string cmdexePath = @"C:\Windows\System32\cmd.exe";
      string myApplication = @"d:/SL3-xgold/tools/oclHashcat-lite-0.05/" + toquen;
      string cmdArguments = String.Format("/K {0}", myApplication);
  
      OCLProcess = new Process();
      OCLProcess.StartInfo.FileName = cmdexePath;
      OCLProcess.StartInfo.Arguments = cmdArguments;
      OCLProcess.StartInfo.UseShellExecute = false;
      OCLProcess.StartInfo.RedirectStandardOutput = true;
      OCLProcess.OutputDataReceived += OutputHandler;
  
      OCLProcess.Start();
      OCLProcess.BeginOutputReadLine();            
  }
  
  private static void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
  {
      if (!String.IsNullOrEmpty(outLine.Data))
      {
          MessageBox.Show(outLine.Data);
      }
  }
  </code></pre>
  
  <p>The problem is that I read all the lines of the console application but the last one which is only read when I close the console application. Any theory about it?</p>