| title | _com_ptr_t::Attach | Microsoft Docs | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ms.custom | ||||||||||||||
| ms.date | 11/04/2016 | |||||||||||||
| ms.reviewer | ||||||||||||||
| ms.suite | ||||||||||||||
| ms.technology |
|
|||||||||||||
| ms.tgt_pltfrm | ||||||||||||||
| ms.topic | language-reference | |||||||||||||
| f1_keywords |
|
|||||||||||||
| dev_langs |
|
|||||||||||||
| helpviewer_keywords |
|
|||||||||||||
| ms.assetid | 94c18e0a-06be-4ca7-bdaf-cd54ec0a645e | |||||||||||||
| caps.latest.revision | 6 | |||||||||||||
| author | mikeblome | |||||||||||||
| ms.author | mblome | |||||||||||||
| manager | ghogen | |||||||||||||
| translation.priority.ht |
|
Microsoft Specific
Encapsulates a raw interface pointer of this smart pointer's type.
void Attach(
Interface* pInterface
) throw( );
void Attach(
Interface* pInterface,
bool fAddRef
) throw( );
pInterface
A raw interface pointer.
fAddRef
If it is true, then AddRef is called. If it is false, the _com_ptr_t object takes ownership of the raw interface pointer without calling AddRef.
-
Attach(
pInterface)AddRefis not called. The ownership of the interface is passed to this_com_ptr_tobject. Release is called to decrement the reference count for the previously encapsulated pointer. -
Attach(
pInterface,fAddRef) IffAddRefis true,AddRefis called to increment the reference count for the encapsulated interface pointer. IffAddRefis false, this_com_ptr_tobject takes ownership of the raw interface pointer without callingAddRef. Release is called to decrement the reference count for the previously encapsulated pointer.
END Microsoft Specific