MFC裏面CString 與 string 互相轉化 的問題。_基礎類_VC/MFC-ITnose http://www.itnose.net/detail/6110703.html
大致是這樣
CString-string:
CString str1;
m_editUsername.GetWindowTextW(str1);
char *chr1 = new char[str1.GetLength() + 1];
WideCharToMultiByte(CP_ACP, 0, str1.GetBuffer(), -1, chr1, str1.GetLength() + 1, NULL, NULL);
string tmp1 = chr1;
string-CStirng:
CString str;(注意:不能寫成CString str=userID.c_str();)
str = userID.c_str();
AfxMessageBox(str);