_com_ptr_t::_com_ptr_t
Microsoft Specific
_com_ptr_t( ) throw( );
_com_ptr_t( Interface* pInterface ) throw( );
_com_ptr_t( Interface* pInterface, bool fAddRef ) throw( );
_com_ptr_t( int NULL ) throw( _com_error );
template< > _com_ptr_t( const _com_ptr_t& cp ) throw( );
template<typename _InterfacePtr> _com_ptr_t( const _InterfacePtr& p ) throw( _com_error );
template< > _com_ptr_t( const _variant_t& varSrc ) throw( _com_error );
explicit _com_ptr_t( const CLSID& clsid, DWORD dwClsContext = CLSCTX_ALL) throw( _com_error );
explicit _com_ptr_t( LPOLESTR lpOleStr, DWORD dwClsContext = CLSCTX_ALL) throw( _com_error );
explicit _com_ptr_t( LPCSTR lpcStr, DWORD dwClsContext = CLSCTX_ALL ) throw( _com_error );
Parameters
pInterface
a raw interface pointer
fAddRef
if true, AddRef is called to increment the reference count of the encapsulated interface pointer
cp
a _com_ptr_t object
p
a raw interface pointer, its type being different from the smart pointer type of this _com_ptr_t object
varSrc
a _variant_t object
clsid
the CLSID of a coclass
dwClsContext
context for running executable code
lpOleStr
a Unicode string that holds either a CLSID (starting with “{“) or a ProgID
lpcStr
a multibyte string that holds either a CLSID (starting with “{“) or a ProgID.
Remarks
Constructs a _com_ptr_t object.
-
_com_ptr_t( ) Constructs a NULL smart pointer.
-
_com_ptr_t( pInterface ) Constructs a smart pointer from a raw interface pointer of this smart pointer’s type. AddRef is called to increment the reference count for the encapsulated interface pointer.
-
_com_ptr_t( pInterface, fAddRef ) Constructs a smart pointer from a raw interface pointer of this smart pointer’s type. If fAddRef is true, AddRef is called to increment the reference count for the encapsulated interface pointer. If fAddRef is false, this constructor takes ownership of the raw interface pointer without calling AddRef.
-
_com_ptr_t( NULL ) Constructs a NULL smart pointer. The NULL argument must be a zero.
-
_com_ptr_t( cp ) Constructs a smart pointer as a copy of another instance of the same smart pointer. AddRef is called to increment the reference count for the encapsulated interface pointer.
-
_com_ptr_t( p ) Constructs a smart pointer from a different smart pointer type or from a different raw interface pointer. QueryInterface is called to find an interface pointer of this smart pointer’s type. If QueryInterface fails with an E_NOINTERFACE error, a NULL smart pointer is constructed. Any other error causes a _com_error to be raised.
-
_com_ptr_t( varSrc ) Constructs a smart pointer from a _variant_t object. The encapsulated VARIANT must be of type VT_DISPATCH or VT_UNKNOWN, or it can be converted into one of these two types. If QueryInterface fails with an E_NOINTERFACE error, a NULL smart pointer is constructed. Any other error causes a _com_error to be raised.
-
_com_ptr_t( clsid, dwClsContext ) Constructs a smart pointer given the CLSID of a coclass. This function calls CoCreateInstance, by the member function CreateInstance, to create a new COM object and then queries for this smart pointer’s interface type. If QueryInterface fails with an E_NOINTERFACE error, a NULL smart pointer is constructed. Any other error causes a _com_error to be raised.
-
_com_ptr_t( lpOleStr, dwClsContext ) Constructs a smart pointer given a Unicode string which holds either a CLSID (starting with “{“) or a ProgID. This function calls CoCreateInstance, by the member function CreateInstance, to create a new COM object and then queries for this smart pointer’s interface type. If QueryInterface fails with an E_NOINTERFACE error, a NULL smart pointer is constructed. Any other error causes a _com_error to be raised.
-
_com_ptr_t( lpcStr, dwClsContext ) Constructs a smart pointer given a multibyte character string which holds either a CLSID (starting with “{“) or a ProgID. This function calls CoCreateInstance, by the member function CreateInstance, to create a new COM object and then queries for this smart pointer’s interface type. If QueryInterface fails with an E_NOINTERFACE error, a NULL smart pointer is constructed. Any other error causes a _com_error to be raised.
_com_ptr_t Overview
END Microsoft Specific