关于 CComBSTR BSTR char* 之间的转换
请问以下几种情况正确吗:
1.
CComBSTR cbstr(L"jacky ff");
TCHAR * p=cbstr;
trace(p);
//编译和运行通过
2.
BSTR bstrText = ::SysAllocString(L"Tesvvvvt");
p=bstrText;
trace(p);
SysFreeString(bstrText); // 用完释放
BSTR可以直接赋值给char*吗?
//编译和运行通过
3.
BSTR bstrText = _bstr_t("This is a test");
//编译和运行通过
//但问题是_bstr_t调用了析构函数了。
4.
BSTR bstrText = CComBSTR("This is a test");
//编译和运行通过
//但问题是CComBSTR调用了析构函数了。