'LoadStringA' 和 'LoadStringW' 有什么区别?
What's the difference between 'LoadStringA' and 'LoadStringW'?
我最近开始学习 Win32 API,我不明白 LoadStringA 和 LoadStringW[=20 函数之间的主要区别=].
我看到的唯一区别是参数的类型,例如 LPWSTR 而不是 LPSTR。我什么时候应该使用 LoadStringA 而不是 LoadStringW?
这在官方文档中有解释:Working with Strings
When Microsoft introduced Unicode support to Windows, it eased the
transition by providing two parallel sets of APIs, one for ANSI
strings and the other for Unicode strings. For example, there are two
functions to set the text of a window's title bar:
SetWindowTextA takes an ANSI string.
SetWindowTextW takes a Unicode
string.
至于推荐,其中“新”是指比 1995 年左右更新...
New applications should always call the Unicode versions. Many world
languages require Unicode. If you use ANSI strings, it will be
impossible to localize your application. The ANSI versions are also
less efficient, because the operating system must convert the ANSI
strings to Unicode at run time.
我最近开始学习 Win32 API,我不明白 LoadStringA 和 LoadStringW[=20 函数之间的主要区别=].
我看到的唯一区别是参数的类型,例如 LPWSTR 而不是 LPSTR。我什么时候应该使用 LoadStringA 而不是 LoadStringW?
这在官方文档中有解释:Working with Strings
When Microsoft introduced Unicode support to Windows, it eased the transition by providing two parallel sets of APIs, one for ANSI strings and the other for Unicode strings. For example, there are two functions to set the text of a window's title bar:
SetWindowTextA takes an ANSI string.
SetWindowTextW takes a Unicode string.
至于推荐,其中“新”是指比 1995 年左右更新...
New applications should always call the Unicode versions. Many world languages require Unicode. If you use ANSI strings, it will be impossible to localize your application. The ANSI versions are also less efficient, because the operating system must convert the ANSI strings to Unicode at run time.