AtlComPtrAssign

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

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

Concepts

CComPtr Class

CComQIPtr Class