CreateWindowEx、CreateWindowExA、CreateWindowExW 之间有什么区别?
What is differnece between CreateWindowEx, CreateWindowExA, CreateWindowExW?
我阅读了有关 CreateWindowEx
CreateWindowExA
CreateWindowExW
的文档,它们似乎彼此相同。
如果没有区别,为什么它们都存在?
首先,CreateWindowEx
是一个宏,它根据是否定义了UNICODE
扩展为CreateWindowExA
或CreateWindowExW
。许多 WinAPI 函数都是这样工作的:它们有一个宏,可以根据 UNICODE
在适当的函数之间切换,然后有 A
和 W
版本。
现在,A
和 W
版本的区别非常简单。
The "A" version handles text based on Windows code pages, while the "W" version handles Unicode text.
-- 来源:https://docs.microsoft.com/en-us/windows/win32/intl/code-pages
The winuser.h header defines CreateWindowEx as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
我阅读了有关 CreateWindowEx
CreateWindowExA
CreateWindowExW
的文档,它们似乎彼此相同。
如果没有区别,为什么它们都存在?
首先,CreateWindowEx
是一个宏,它根据是否定义了UNICODE
扩展为CreateWindowExA
或CreateWindowExW
。许多 WinAPI 函数都是这样工作的:它们有一个宏,可以根据 UNICODE
在适当的函数之间切换,然后有 A
和 W
版本。
现在,A
和 W
版本的区别非常简单。
The "A" version handles text based on Windows code pages, while the "W" version handles Unicode text.
-- 来源:https://docs.microsoft.com/en-us/windows/win32/intl/code-pages
The winuser.h header defines CreateWindowEx as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.