重载了此操作符,from csdn:operator const char*( ) These operators can be used to extract raw pointers to the encapsulated Unicode or multibyte BSTR object. The operators return the pointer to the actual internal buffer, so the resulting string cannot be modified.所以他自动转换。
CComBSTR也是ATL提供的COM组件来支持BSTR类型的运算。使用它会自动申请和释放内存资源。使用方法:
Cwindow wndobj;
wndobj.Attach(m_ctlEdit.m_hWnd);
CComBSTR bstr_display(“”);
wndobj.GetWindowText(bstr_display.m_str);
bstr_display.Append(_T(“\r\nLeft Button Click Trigger Event OnLButtonDblClk”));
_bstr_t display(bstr_display.m_str);
Wndobj.SetWindowText(display);