CComPtr

temp&latelt; classeT >
classe CComPtr

Parametri

T

Un'interfaccia COM specificando il tipo di puntatore a essere memorizzati.

ATL utilizza CComPtr e CComQIPtr per gestire i puntatori a interfaccia COM. Entrambe le classi eseguono il conteggio mediante chiamate a AddRef e Releaseautomatico dei riferimenti. Operatori di overload di gestire le operazioni di puntatore. CComQIPtr supporta inoltre automatico query delle interfacce perņ QueryInterface.

Il codice seguente č da CFirePropNotifyEvent::FireOnRequestEdit

statico HRESULT FireOnRequestEdit(IUnknown* pUnk, DISPID dispID)
{
 nbsp; CComQIPtr < IConnectionPointContainer & IID_IConnectionPointContainer > pCPC(pUnk);
   Se (! pCPC)
      restituisce S_OK;

PCP CComPtr <IConnectionPoint>;
   pCPC - > FindConnectionPoint (IID_IPropertyNotifySink & pCP);
   Se (! pCP)
      restituisce S_OK;

...
}

In questo esempio viene illustrato quanto segue:

# include lt;atlbase.h>

Membri della classe

Vedere a&nchenbsp;CComPtr::CComPtr, CComQIPtr::CComQIPtr

Index