How to convert _bstr_t to CString

subbu picture subbu · Nov 6, 2009 · Viewed 31.4k times · Source

I have a _bstr_t variable bstrErr and I am having a CString variable csError. How do I set the value which come in bstrErr to csError?

Answer

Andrew picture Andrew · Nov 6, 2009

Is it not possible just to cast it:

_bstr_t b("Steve");
CString cs;
cs = (LPCTSTR) b;

I think this should work when the project is Unicode.