Visual Studio C ++如何在我的“关于”框中显示动态消息(即字符串)? [英] Visual Studio C++ how to display a dynamic message (i.e., string) in my About box?

查看:291
本文介绍了Visual Studio C ++如何在我的“关于”框中显示动态消息(即字符串)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应该是微不足道的。 。 。当通过VS资源编辑器编辑....工具/对象列表只显示静态文本和创建事件处理程序向导具有所有字段和[下一步]按钮变暗(禁用)。

Should be trivial . . . when editing via the VS resource editor.... the tools/objects list only shows 'static text' and the create an event handler wizard has all fields and [next] button dimmed (disabled).

我有一个可爱的关于框 - 一切正常 - 而不是静态文本字段显示 -

I have a lovely About box -- it all works -- but instead of static text fields to display --

我想/需要显示当前运行时状态信息的几行(字符串).....

I want/need to display several lines (strings) of current runtime status info.....

我只是知道Visual Studio足够好m使用2008)。 。 。

I just do know Visual Studio well enough (I'm using 2008). . .

如果任何一个有一个简单的例子 - 这真的是我需要的。

If any one has a simple example -- that really is all I need.

最好的问候,
Kevin Waite

best regards, Kevin Waite

推荐答案

你在对话框中放置一个静态文本框,你可以在运行时将其文本设置为任何你想要的。首先需要获取文本框的窗口句柄:

If you put a static text box in your dialog you can set its text to anything you want at runtime. First you need to get the window handle of the text box:

HWND hwndText = GetDlgItem(hwndDialog, IDC_MYTEXT);

然后你可以设置新的文本:

Then you can set the new text into it:

SetWindowText(hwndText, L"Hi mom, this is my first text box!");

静态文本不意味着改变,所以Windows不总是做正确的事情,当你更改。您需要告诉它擦除和重绘,以便正确显示新文本。

Static text isn't meant to change, so Windows doesn't always do the right thing when you change it. You need to tell it to erase and repaint so that the new text is properly displayed.

InvalidateRect(hwndText, NULL, true);

这篇关于Visual Studio C ++如何在我的“关于”框中显示动态消息(即字符串)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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