Partager via


AtlComQIPtrAssign

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

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

Parameters

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

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

  • riid
    The IID of the requested interface.

Return Value

Returns NULL on error; otherwise returns lp.

Remarks

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.

Requirements

Header: atlcomcli.h

See Also

Concepts

CComPtr Class

CComQIPtr Class