CreateWindowEx 的 lpClassName 参数如何是可选的 [英] How can the lpClassName parameter of CreateWindowEx be optional

查看:33
本文介绍了CreateWindowEx 的 lpClassName 参数如何是可选的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 MSDNCreateWindowEx 的 lpClassName 参数是可选的.

According to MSDN, the lpClassName parameter of CreateWindowEx is optional.

lpClassName [输入,可选]

lpClassName [in, optional]

然而,文档没有提到传递NULL 意味着什么.更重要的是,如果NULL被传递,那么窗口管理器就没有办法为新窗口找到一个窗口过程.

However, the documentation makes no mention of what it means to pass NULL. What's more, if NULL is passed, then there is no way for the window manager to find a window procedure for the new window.

那么,文档是错误的吗?或者它是否正确并且在某些情况下 NULLlpClassName 的有效值?

So, is the documentation wrong? Or is it correct and there is some scenario where NULL is a valid value for lpClassName?

推荐答案

CreateWindowExlpClassName 参数被声明为一个 LPCTSTR 但它实际上可以是指向字符串的指针,也可以是 RegisterClassRegisterClassEx 返回的类原子.

The lpClassName parameter to CreateWindowEx is declared to be an LPCTSTR but it can actually be either a pointer to a string or a class atom returned by RegisterClass or RegisterClassEx.

理想情况下,类型注释将准确指定此参数允许使用的内容,但我猜注释语言无法描述与其声明类型不匹配的事物类型.

Ideally the type annotation would specify precisely what's allowed for this parameter, but I guess the annotation language doesn't have a way of describing the types of things that don't match their declared type.

他们能做的最好的事情就是将其声明为可选,以表明该字符串可能无效.

The best they could do is declare it as optional to indicate that the string might not be valid.

这篇关于CreateWindowEx 的 lpClassName 参数如何是可选的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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