在Windows中显示文本消息 [英] Displaying a text message in Windows

查看:120
本文介绍了在Windows中显示文本消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Windows中显示状态文本消息?在控制台模式下,我只会在程序中的适当位置使用COUT。在Windows中,它看起来非常复杂。 MessageBox无法正常工作,因为它是一个模态进程。



我的程序是通过热文件夹启动的,并且基于相关控制文件的内容,处理各种任务。我想生成一条短信,并在每一步的开始和结束时在屏幕上显示。



程序完成后,消息窗口将消失。



提前谢谢。

How do I display a status text message in windows? In Console mode I would just utilize COUT at the appropriate location in my program. In Windows it appears to be very complicated. MessageBox won't work, as it is a Modal process.

My program is initiated via a "Hot Folder", and based upon the contents of an associated control file, various tasks are processed. I would like to generate a text message and display it on the screen at the beginning and ending of each step.

When the program is completed, message window is to disappear.

Thanks in advance.

推荐答案

它有点容易,有一些警告



您必须在对话框资源上使用MFC的CDialog或ATL的CDialogImpl<>创建一个对话框 - CP Example [ ^ ]



主要警告是必须在您的对话框上创建此对话框主线程,这可能意味着您将需要运行消息泵 [ ^ ]或者你会有油漆问题 - 如果(正如我猜测的那样)你被吸引到了Shell中,那只是运行STA,这意味着你必须要小心线程



可以打开 - 到处都是蠕虫:)
it's sort of easy, with some caveats

you'll have to create a dialog, using MFC's CDialog or ATL's CDialogImpl<>, on top of a dialog resource - CP Example[^]

The major caveat is that this dialog must be created on your main thread, which probably means you're going to need to run a message pump[^] in that thread too or you'll have paint issues - if (as i'm guessing) you're hooked into the Shell, that only runs STA, which means you have to be careful about threading

can open - worms everywhere :)


这篇关于在Windows中显示文本消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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