char[] 转换为LPWSTR

xiaoxiao2021-02-28  59

1、char[] 转换为 LPWSTR

解决方案:

思路一: 使用CA2W字符转换宏(ATL and MFC String Conversion Macros)。 根据MSDN描述,这个宏用于将ANSI转换为Wide Character(UNICODE)

代码如下: LPWSTR aaa = CA2W(text); item.pszText = aaa;

思路二: 使用int MultiByteToWideChar()函数。根据MSDN描述,这个方法:This function maps a character string to a wide-character (Unicode) string。

代码如下:

TCHAR aaa[31]; MultiByteToWideChar(0,0,text,31,aaa,62);

转载请注明原文地址: https://www.6miu.com/read-72926.html

最新回复(0)