1.BSTR是COM中使用的基本类型,赋值需用SysAllocString
BSTR bstr = NULL;
bstr = SysAllocString(L"data");
BSTR转为CString可强制转换
CString str = (CString)bstr
CString转为BSTR
CString str;
BSTR bstr = str.AllocSysString();
2._bstr_t是BSTR的包装类
1.可对_bstr_t类的对象直接赋值
_bstr_t tbstr = "data";
LPCSTR str = tbstr;
CString str = (LPCSTR)tbstr;
BSTR bstr = tbstr.copy();
SysFreeString(bstr);
BSTR bstr = SysAllocString(L"data");
_bstr_t tbstr = bstr;