如何在GUI应用程序中写入控制台 [英] How to write to the console in a GUI application

查看:105
本文介绍了如何在GUI应用程序中写入控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我们开发win32应用程序,并在Windows上使用 Thompson Toolkit为我们提供了一个类unix的外壳,我们将其用作命令行。

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.

我们有一个要写入控制台的GUI程序(带有WinMain和消息循环),但是即使从控制台启动该程序,printf等也不起作用。我们如何从GUI程序写入控制台?我们需要在此处打印文本,以便自动构建系统可以显示错误消息等。

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.

谢谢。

推荐答案

简而言之,您需要附加一个控制台。有关详细信息和准备使用的代码,请参见 http://www.codeproject.com/KB/ dialog / ConsoleAdapter.aspx

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

这篇关于如何在GUI应用程序中写入控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆