string-->CString
CString CharToWChar(const char* sstr)
{
int len = MultiByteToWideChar(CP_ACP, 0, sstr, -1, NULL, 0);
wchar_t* wstr = new wchar_t[len + 1];
memset(wstr, 0, len + 1);
MultiByteToWideChar(CP_ACP, 0, sstr, -1, wstr, len);
CString str = wstr;
if (wstr) delete[] wstr;
return str;
}
const char* WCharToChar(CString sstr)
{
int char_count = WideCharToMultiByte(CP_ACP, 0, sstr.GetBuffer(), -1, NULL, 0, NULL, NULL);
char * pastring = new char[char_count];
WideCharToMultiByte(CP_ACP, 0, sstr.GetBuffer(), -1, pastring, char_count, NULL, NULL);
return pastring;
}
DWORD CStringToint(CString sstr)
{
const char* P = WCharToChar(sstr);
int t_Data = atoi(P);
delete[] P;
return t_Data;
}