Collapse the table of content
Expand the table of content


Assigns an interface pointer to another interface pointer of a different type.

ATLINLINE ATLAPI_(IUnknown*) AtlComQIPtrAssign( 
   IUnknown** pp, 
   IUnknown* lp, 
   REFIID riid 


Address of an IUnknown pointer to which to assign another pointer.


An IUnknown pointer of a type different from the one in pp. This is assigned to the pointer in pp.


The IID of the requested interface.

Returns NULL on error; otherwise returns lp.

This function copies an interface pointer using COM reference counting rules. It calls QueryInterface on lp, specifying riid to obtain the required interface. It calls Release on the interface pointed to by pp and then assigns the pointer returned by QueryInterface.

This smart pointer helper function is used by CComPtr Class and CComQIPtr Class.

Header: atlcomcli.h

© 2016 Microsoft