What does LPCWSTR stand for and how should it be handled with?

后端 未结 3 1405
醉话见心
醉话见心 2020-11-29 18:47

First of all, what is it exactly? I guess it is a pointer (LPC means long pointer constant), but what does \"W\" mean? Is it a specific pointer to a string or a pointer to a

3条回答
  •  萌比男神i
    2020-11-29 19:12

    LPCWSTR is equivalent to wchar_t const *. It's a pointer to a wide character string that won't be modified by the function call.

    You can assign to LPCWSTRs by prepending a L to a string literal: LPCWSTR *myStr = L"Hello World";

    LPCTSTR and any other T types, take a string type depending on the Unicode settings for your project. If _UNICODE is defined for your project, the use of T types is the same as the wide character forms, otherwise the Ansi forms. The appropriate function will also be called this way: FindWindowEx is defined as FindWindowExA or FindWindowExW depending on this definition.

提交回复
热议问题