The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

_bstr_t Class


The latest version of this topic can be found at _bstr_t Class.

Microsoft Specific**

A _bstr_t object encapsulates the BSTR data type. The class manages resource allocation and deallocation through function calls to SysAllocString and SysFreeString and other BSTR APIs when appropriate. The _bstr_t class uses reference counting to avoid excessive overhead.


_bstr_tConstructs a _bstr_t object.


AssignCopies a BSTR into the BSTR wrapped by a _bstr_t.
AttachLinks a _bstr_t wrapper to a BSTR.
copyConstructs a copy of the encapsulated BSTR.
DetachReturns the BSTR wrapped by a _bstr_t and detaches the BSTR from the _bstr_t.
GetAddressPoints to the BSTR wrapped by a _bstr_t.
GetBSTRPoints to the beginning of the BSTR wrapped by the _bstr_t.
lengthReturns the number of characters in the _bstr_t.


operator =Assigns a new value to an existing _bstr_t object.
operator +=Appends characters to the end of the _bstr_t object.
operator +Concatenates two strings.
operator !Checks if the encapsulated BSTR is a NULL string.
operator ==, !=, <, >, <=, >=Compares two _bstr_t objects.
operator wchar_t* | char*Extract the pointers to the encapsulated Unicode or multibyte BSTR object.

Header: comutil.h

Lib: comsuppw.lib or comsuppwd.lib (see /Zc:wchar_t (wchar_t Is Native Type) for more information)

Compiler COM Support Classes