1、将CString转换为const char*
CString str = _T("231222");
std::string strDp = CStringA(str); //或: std::string strDp = CT2A(str, CP_ACP);
2、将const char*转换为wchar_t*类型
size_t len = strDp.length() + 1;
size_t converted = 0;
wchar_t * WStr = (wchar_t*)malloc(len * sizeof(wchar_t));
mbstowcs_s(&converted, WStr, len, strDp.c_str(), _TRUNCATE);