Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ComPtr::CopyTo Method

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at ComPtr::CopyTo Method.

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:
© 2017 Microsoft