在win32中更新静态文本 [英] Update static text in win32

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

问题描述

关于您在任务管理器底部看到的静态文本标签的快速问题(它告诉您win7中的总进程数和CPU使用率)

实现这种行为win32你真的需要销毁并重新创建与更新文本一起显示的静态文本的相同句柄吗?



使用C#和windows表单文本标签有一个特定的改变所述标签的文字的功能,但这背后的魔力是什么?它实际上是被摧毁并再次重建吗?这是我们应该做出这种行为的方式吗?



inb4只读编辑框 - 如果你将鼠标悬停在你可以选择的那些上文本和光标发生了变化,确定你可以改变那个控件的wndproc函数,但是当你在资源编辑器中创建它们时,这将是一种太过分的方法,无法改变imho

Quick question about the static text labels that you see in the bottom end of the task manager (which tells you the total processes numbers and CPU usage in win7)
To implement this kind of behaviour in win32 do you actually need to destroy and recreate the same handle to the static text to be displayed whit the updated text ?

Using C# and windows forms a textlabel has a specific function to change said label's text, but what's the magic behind this ? Is it actually "destroyed" and recreated again ? Is this the way that we're supposed to make such behaviour ?

inb4 read-only editboxes - if you hover the mouse on those you'll be able to select the text and the cursor changes, sure you could change that control's wndproc function but that would be way too overkill imho

推荐答案

他们的ID来自ID_STATIC



然后只是GetDlgItem() - > SetWindowText()(或其变体)
when you create them in the resource editor, change their ID from ID_STATIC

then simply GetDlgItem()->SetWindowText() (or variant of) on them


这篇关于在win32中更新静态文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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