To handle BSTR string type, we need use Windows API functions:
SysAllocString(), SysAllocStringLen(), SysAllocStringByteLen(),
SysReAllocString(), SysReAllocStringLen(),
adn SysFreeString
also you can take use of class CComBSTR and _bstr_t.
The CComBSTR class is a wrapper for BSTRs, length-prefixed strings. The length is stored as an integer at the memory location preceding the data in the string.
Class _bstr_t is one of the compiler COM support classes declared in COMDEF.H. It wraps the BSTR type to provide useful operators and methods. See the Compiler COM Support Classes for more information.