Can I access the string returned from a Delphi CreateProcess command?

前端 未结 2 2091
挽巷
挽巷 2021-02-11 09:35

I\'m using the Win32 CreateProcess function to perform a call to an external executable. The executable returns a string.

Is there a way I can capture and

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-11 09:46

    Assuming that you want to capture what the exe is writing to the standard output, you can start it with

    yourprog.exe > results.txt
    

    This will write the output to results.txt, which you can then read and evaluate.

    Or, you can try the method explained in this thread: Create a pipe for the output from your spawned process and read from it. Post number 7 has a source example on how to use the relevant WinApi functions in C++, that should easily translate into Delphi.

提交回复
热议问题