Roger Cigol 107 Posted June 27, 2021 I have a C++ Builder (10.4.2) Windows 64 bit VCL application (clang64). Whilst it is running I want to start an external (third party) windows 64 bit exe console application and whilst this runs to completion I want my VCL application to capture (and I will write code to process) the) text output that the third party exe file sends to "standard output". Ideally I want to do this without the user being aware that it is happening. It's easy to run an external console application in it's own shell, but how do I redirect the output from this external console application into my (already running) VCL application? Share this post Link to post
pyscripter 694 Posted June 27, 2021 There are many Delphi units for doing that e.g. - JCL library in JclSysUtils Execute functions - JVCL JvCreateProcess component and many others Share this post Link to post
Rollo62 538 Posted June 27, 2021 DosCommand should be available in GetIt Share this post Link to post
corneliusdavid 220 Posted June 27, 2021 Yes, DosCommand has both Delphi and C++ Builder packages to do exactly what you need. Share this post Link to post
Remy Lebeau 1421 Posted June 28, 2021 (edited) If you don't want to rely on 3rd party wrappers, it is not very overly complicated to redirect the output and read it manually. Just create a pipe, assign it to the STARTUPINFO passed to CreateProcess(), and then read from the pipe. MSDN documents this task: Creating a Child Process with Redirected Input and Output Edited June 28, 2021 by Remy Lebeau 1 1 Share this post Link to post
Roger Cigol 107 Posted June 2, 2022 Thanks Remy - as you rightly say, it's not too difficult to get the console interface working. Slightly harder to write a unit test to prove that unicode chars are handled ok. But I got there in the end. Thanks for pointing me in the right direction. Share this post Link to post