std::string ConvertLPCTSTRToString(LPCTSTR lpctstr) {
int length = lstrlen(lpctstr);
int size = WideCharToMultiByte(CP_UTF8, 0, lpctstr, length, nullptr, 0, nullptr, nullptr);
if (size == 0) {
return "";
}
std::string str(size, '\0');
WideCharToMultiByte(CP_UTF8, 0, lpctstr, length + 1, &str[0], size, nullptr, nullptr);
return str;
}
LPWSTR ConvertToLPWSTR(const std::string& s)
{
LPWSTR ws = new wchar_t[s.size() + 1];
copy(s.begin(), s.end(), ws);
ws[s.size()] = 0;
return ws;
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21