user2338150
user2338150

Reputation: 485

Retrieve Console Output dynamically into GUI window in Win32 API

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: enter image description 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

Answers (1)

David Heffernan
David Heffernan

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

Related Questions