0

I have two applications: one written in Delphi6 is a main application, other written in C# is a plug-in exe module which outputs its result to console.

Could you provide some example of how to run this plug-in exe with CreateProcess and get it's console output to string or WideString ?

Paul
  • 25,812
  • 38
  • 124
  • 247

1 Answers1

1

Creating a Child Process with Redirected Input and Output

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • Couldn't get this work. Console window flashes for a moment and then `ReadFile` in `ReadFromPipe` waits forever. – Paul Oct 26 '13 at 20:03
  • I am not very familiar with C# development. Are you sure the C# app uses the standard console output and not some custom output? Please update your question to show the actual code you are using now. – Remy Lebeau Oct 26 '13 at 21:08
  • I am pretty sure as I was able to redirect its output to file using command line. I think this is a synchronization problem. The app finishes before I capture its output. BTW: people complain about the same issue in comments to that article. – Paul Oct 28 '13 at 09:47
  • 1
    Even if the client process ends, the pipe will still be open since you have active handles to it, so you can sill read any data the child process wrote to the pipe. – Remy Lebeau Oct 28 '13 at 22:18