Compartilhar via


AtlComPtrAssign

 

Assigns an interface pointer to another interface pointer of the same type.

Syntax

      ATLINLINE ATLAPI_(IUnknown*) AtlComPtrAssign(
   IUnknown** pp,
   IUnknown* lp
);

Parameters

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

  • lp
    An IUnknown pointer of the same type as the one in pp. This is assigned to the pointer in pp.

Return Value

Returns NULL on error; otherwise returns lp.

Remarks

This function copies an interface pointer using COM reference counting rules. It calls Release on the interface pointed to by pp and then assigns lp to it after incrementing the reference count.

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

Requirements

Header: atlcomcli.h

See Also

CComPtr Class
CComQIPtr Class