如何学习 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();
posted @ 2017-09-20 23:10  學海無涯  阅读(386)  评论(0编辑  收藏  举报