注册窗口类 [英] Registering Window Class

查看:15
本文介绍了注册窗口类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于那些花时间处理 Win32 API 的人来说,我想我的问题相对容易.

I guess my question is relatively easy for those of you who spent time dealing with Win32 API.

所以我的问题是:
初始化WNDCLASSEX实例后,我们需要使用RegisterClassEx"函数注​​册"它,为什么?我们为什么要这样做?这个注册有什么意义,什么情况下需要注册东西?

So my question is:
After initializing a WNDCLASSEX instance we need to "register" it using the "RegisterClassEx" function, why? Why do we do that? What's the meaning of this registration and in what cases I need to register things?

推荐答案

RegisterClassEx 返回的 ATOM 唯一标识您的窗口类",然后可以在其他 Windows API.[MSDN]

The ATOM returned by RegisterClassEx uniquely identifies your "window class" which can then be referred to in other windows APIs. [MSDN]

实际上它是一个散列,以减少每次创建或查找窗口时处理的数据量.这也意味着可以轻松创建和识别具有相同功能的多个窗口.

Effectively it is a hash so as to reduce the amount of data processed each time a window is created or looked for. It does also mean that multiple windows with same features can be easily created and identified.

我正在解决上述实际原因.Hans Passant 的 answer 正确地解释了这是为 C 提供的 OO 类概念.更多 MSDN 示例.

I was addressing the practical reasons above. Hans Passant's answer correctly explains this is the OO class concept provided for C. Further MSDN example.

这篇关于注册窗口类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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