在 Windows 窗体上获取文本的方法(非托管 C++ 项目)
我正在学习 C++。我在 VC++ 2008 中创建了一个样板 Win32 应用程序。我已经研究了代码并准备做一些实验。我认为将消息循环中收到的所有 Windows 消息打印到通过样板代码创建的表单会很酷。我一生都无法弄清楚将文本输入该表单的方法。我似乎无法识别和命名对象,我可以用来引用那个该死的形式。我能想到的最好的办法是我需要使用句柄以某种方式引用表单。不过,即使我确实知道如何引用表单,我也不确定是否知道如何创建标签来显示文本。不管怎样,如果有人能指出我需要学习什么方法才能实现这一点,我将不胜感激。
谢谢, 多诺万
I'm in the process of learning C++. I've created a boilerplate Win32 app within VC++ 2008. I've studied through the code and am ready do do a bit of experimenting. I thought it would be cool to print all the windows messages received in the message loop to the form created via the boilerplate code. I for the life of me, can't figure out the method of getting text onto that form. I can't seem to identify and named object that I can use to reference that damn form. The best I can figure is I need to use the handle to reference the form somehow. Still, even if I did know how to reference the form, I'm not sure I know how I would create a label to display the text. Anyway, if someone could just point out what methodology I need to learn to make this happen it would be much appreciated.
Thanks,
Donovan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用资源创建了标签,请使用其资源 ID,并且
也有 MFC 等效项,应该可以帮助您找到正确的方向。请注意,发布消息循环意味着大量的信息......可能不想这样做。检查 Spy++ 是否仍然可用并正在使用,以查看应用程序收到了多少条消息!
If you've created a label using resources, use its resource ID and
There are MFC equivalents for those too, should get you in the right direction. Note that posting message loop means lots and lots of information... might not want to do that. Check Spy++ if that's still available and in use today to see how many messages an app gets!