Share via


_bstr_t::_bstr_t

Microsoft Specific

_bstr_t( ) throw( );

_bstr_t( const _bstr_t& s1 ) throw( );

_bstr_t( const char* s2 ) throw( _com_error );

_bstr_t( const wchar_t* s3 ) throw( _com_error );

_bstr_t( const _variant_t& var ) throw ( _com_error );

_bstr_t( BSTR bstr**, bool** fCopy ) throw ( _com_error );

Parameters

s1

a _bstr_t object to be copied

s2

a multibyte string

s3

a Unicode string

var

a _variant_t object

bstr

an existing BSTR object

fCopy

if false, the bstr argument is attached to the new object without making a copy by calling SysAllocString.

Remarks

Constructs a _bstr_t object.

  • _bstr_t( )   Constructs a default _bstr_t object that encapsulates a NULLBSTR object.

  • _bstr_t( _bstr_t& s1 )   Constructs a _bstr_t object as a copy of another. This is a “shallow” copy, which increments the reference count of the encapsulated BSTR object instead of creating a new one.

  • _bstr_t( char* s2 )   Constructs a _bstr_t object by calling SysAllocString to create a new BSTR object and encapsulate it. This constructor first performs a multibyte to Unicode conversion.

  • _bstr_t( wchar_t* s3 )   Constructs a _bstr_t object by calling SysAllocString to create a new BSTR object and encapsulates it.

  • _bstr_t( _variant_t& var )   Constructs a _bstr_t object from a _variant_t object by first retrieving a BSTR object from the encapsulated VARIANT object.

  • _bstr_t( BSTR bstr**, bool** fCopy )   Constructs a _bstr_t object from an existing BSTR (as opposed to a wchar_t* string). If fCopy is false, the supplied BSTR is attached to the new object without making a new copy via SysAllocString. This is the method used by the wrapper functions in the type library headers to encapsulate and take ownership of a BSTR, returned by an interface method, in a _bstr_t object.

_bstr_t Overview

END Microsoft Specific