直接调用下列方法,输入参数即可转换
wstring InjectDll::charToWstring(const char* szIn)
{
int length = MultiByteToWideChar(CP_ACP, 0, szIn, -1, NULL, 0);
WCHAR* buf = new WCHAR[length + 1];
ZeroMemory(buf, (length + 1) * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szIn, -1, buf, length);
std::wstring strRet(buf);
delete[] buf;
return strRet;
}
标签:const,szIn,wstring,char,length,strRet,WCHAR,buf From: https://blog.51cto.com/u_15906863/5978179