Exemple de point de connexion ATL
Cet exemple montre un objet qui prend en charge IPropertyNotifySink en tant qu’interface sortante :
class ATL_NO_VTABLE CConnect1 :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CConnect1, &CLSID_Connect1>,
public IConnectionPointContainerImpl<CConnect1>,
public IConnectionPointImpl<CConnect1, &IID_IPropertyNotifySink>,
public IConnect1
{
public:
CConnect1()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_CONNECT1)
BEGIN_COM_MAP(CConnect1)
COM_INTERFACE_ENTRY(IConnect1)
COM_INTERFACE_ENTRY(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(CConnect1)
CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
END_CONNECTION_POINT_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
};
Lors de la IPropertyNotifySink
spécification en tant qu’interface sortante, vous pouvez utiliser la classe IPropertyNotifySinkCP au lieu de IConnectionPointImpl
. Par exemple :
class ATL_NO_VTABLE CConnect2 :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CConnect2, &CLSID_Connect2>,
public IConnectionPointContainerImpl<CConnect2>,
public IPropertyNotifySinkCP<CConnect2>
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour