如何学习 MFC ?
//std::string => CString
std::string srcString = "Hello World!";
CString dstString = CString(srcString.c_str());
//std::string => CString
std::string srcString = "Hello World!";
USES_CONVERSION;
CString dstString = A2W(srcString.c_str());
//CString => std::string
CString srcString = CString("Hello World!");
std::string dstString = (CStringA)srcString;
//CString => std::string
#include <atlconv.h>
CString srcString = CString("Hello World!");
USES_CONVERSION;
std::string dstString = W2A(srcString);
AfxMessageBox(string);
BSTR 类型转换
BSTR result;
std::wstring stringResult = (_bstr_t)result;
BSTR dst = (_bstr_t)stringResult .c_str();
转载请注明出处并保持作品的完整性,谢谢