Reputation: 485
Consider the case of a separate executable which has to be called from another application, and the console application emits its progress through stdout
, stderr
outputs. Now, I referred this article on Codeproject, and it allows me to run this application silently. However my main application appears completely frozen as it should since the console application takes its time to finish. Now, it'd be nice to be able to capture the console output and show the progress messages on a 'GUI-like' read-only window as here:
I know it can be done, as they have done for large programs like
ffmpeg
, etc that are console based. How can it be done in Win32 API?
Upvotes: 0
Views: 650
Reputation: 613461
The obvious way is to create a thread that reads the stdout and stderr of the child process. When there is new content, this thread notifies the UI thread which then displays it.
Upvotes: 2