ComPtr::CopyTo Method

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Copies the current or specified interface associated with this ComPtr to the specified pointer.

HRESULT CopyTo(  
   _Deref_out_ InterfaceType** ptr  
);  
  
HRESULT CopyTo(  
   REFIID riid,  
   _Deref_out_ void** ptr  
) const;  
template<  
   typename U  
>  
  
HRESULT CopyTo(  
   _Deref_out_ U** ptr  
) const;  

Parameters

U
A type name.

ptr
When this operation completes, a pointer to the requested interface.

riid
An interface ID.

S_OK if successful; otherwise, an HRESULT that indicates why the implicit QueryInterface operation failed.

The first function returns a copy of a pointer to the interface associated with this ComPtr. This function always returns S_OK.

The second function performs a QueryInterface operation on the interface associated with this ComPtr for the interface specified by the riid parameter.

The third function performs a QueryInterface operation on the interface associated with this ComPtr for the underlying interface of the U parameter.

Header: client.h

Namespace: Microsoft::WRL

ComPtr Class

Show: