Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

_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_t Constructs a _bstr_t object.


Assign Copies a BSTR into the BSTR wrapped by a _bstr_t.
Attach Links a _bstr_t wrapper to a BSTR.
copy Constructs a copy of the encapsulated BSTR.
Detach Returns the BSTR wrapped by a _bstr_t and detaches the BSTR from the _bstr_t.
GetAddress Points to the BSTR wrapped by a _bstr_t.
GetBSTR Points to the beginning of the BSTR wrapped by the _bstr_t.
length Returns the length of the encapsulated BSTR.


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.

END Microsoft Specific


Header: comutil.h

Lib: comsupp.lib

See Also

Compiler COM Support Class Overview

© 2015 Microsoft