Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write to the console in a GUI application

Background: We develop win32 applications, and use the "Thompson Toolkit" on windows to give us a unix-like shell that we use as our command-line.

We have a GUI program (with a WinMain and message loop) that we want to write to the console, but printf and so on don't work, even when we launch the program from the console. How can we write to the console from a GUI program? We need to print text there so that an automated build system can display error messages and so on.

Thanks.

like image 803
Colen Avatar asked Oct 10 '08 17:10

Colen


1 Answers

In short, you need to attach a console. For details and ready to use code, see http://www.codeproject.com/KB/dialog/ConsoleAdapter.aspx.

like image 96
Roel Avatar answered Oct 03 '22 14:10

Roel