64,662
社区成员
发帖
与我相关
我的任务
分享
LPWSTR ConvertCharToLPWSTR(const char * szString)//char 转LPWSTR 这里内存泄漏 调用一次+8k 2018/9/5 22:27 发现暂未解决
{
int dwLen = strlen(szString) + 1;
int nwLen = MultiByteToWideChar(CP_ACP, 0, szString, dwLen, NULL, 0);//算出合适的长度
LPWSTR lpszPath = new WCHAR[dwLen];
MultiByteToWideChar(CP_ACP, 0, szString, dwLen, lpszPath, nwLen);
return lpszPath;
}
void ConvertCharToLPWSTR(const char * szString, LPWSTR pathBuffer, DWORD pathBufferSize)
{
int dwLen = strlen(szString) + 1;
int nwLen = MultiByteToWideChar(CP_ACP, 0, szString, dwLen, NULL, 0);//算出合适的长度
MultiByteToWideChar(CP_ACP, -1, szString, pathBufferSize, lpszPath, nwLen);
}