IDataObject.DAdvise(FORMATETC, ADVF, IAdviseSink, Int32) IDataObject.DAdvise(FORMATETC, ADVF, IAdviseSink, Int32) IDataObject.DAdvise(FORMATETC, ADVF, IAdviseSink, Int32) Method

定义

在数据对象和通知接收器之间创建连接。Creates a connection between a data object and an advisory sink. 此方法由对象进行调用,该对象支持通知接收器并使通知接收器能收到有关对象数据中的更改的通知。This method is called by an object that supports an advisory sink and enables the advisory sink to be notified of changes in the object's data.

public:
 int DAdvise(System::Runtime::InteropServices::ComTypes::FORMATETC % pFormatetc, System::Runtime::InteropServices::ComTypes::ADVF advf, System::Runtime::InteropServices::ComTypes::IAdviseSink ^ adviseSink, [Runtime::InteropServices::Out] int % connection);
public int DAdvise (ref System.Runtime.InteropServices.ComTypes.FORMATETC pFormatetc, System.Runtime.InteropServices.ComTypes.ADVF advf, System.Runtime.InteropServices.ComTypes.IAdviseSink adviseSink, out int connection);
abstract member DAdvise : FORMATETC * System.Runtime.InteropServices.ComTypes.ADVF * System.Runtime.InteropServices.ComTypes.IAdviseSink * int -> int

参数

pFormatetc
FORMATETC FORMATETC FORMATETC

由引用传递的 FORMATETC 结构,它定义以后的通知将使用的格式、目标设备、方面和介质。A FORMATETC structure, passed by reference, that defines the format, target device, aspect, and medium that will be used for future notifications.

advf
ADVF ADVF ADVF

一个 ADVF 值,它指定用于控制通知连接的一组标志。One of the ADVF values that specifies a group of flags for controlling the advisory connection.

adviseSink
IAdviseSink IAdviseSink IAdviseSink

指向将接收更改通知的通知接收器上的 IAdviseSink 接口的指针。A pointer to the IAdviseSink interface on the advisory sink that will receive the change notification.

connection
Int32 Int32 Int32

此方法返回时,包含指向标识此连接的 DWORD 标记的指针。When this method returns, contains a pointer to a DWORD token that identifies this connection. 以后可以使用此标记来删除通知连接,方法是将该标记发送至 DUnadvise(Int32)You can use this token later to delete the advisory connection by passing it to DUnadvise(Int32). 如果此值为零,则未建立连接。If this value is zero, the connection was not established. 此参数未经初始化即被传递。This parameter is passed uninitialized.

返回

此方法支持 E_INVALIDARG、E_UNEXPECTED 和 E_OUTOFMEMORY 等标准返回值,以及下面的值:This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following:

Value 说明Description
S_OKS_OK 已创建通知连接。The advisory connection was created.

E_NOTIMPLE_NOTIMPL 此方法未在数据对象上实现。This method is not implemented on the data object.

DV_E_LINDEXDV_E_LINDEX lindex 有一个无效值;当前,只支持 -1。There is an invalid value for lindex; currently, only -1 is supported.

DV_E_FORMATETCDV_E_FORMATETC pFormatetc 参数有一个无效值。There is an invalid value for the pFormatetc parameter.

OLE_E_ADVISENOTSUPPORTEDOLE_E_ADVISENOTSUPPORTED 该数据对象不支持更改通知。The data object does not support change notification.

注解

有关IDataObject::DAdvise的详细信息,请参阅 MSDN library。For more information about IDataObject::DAdvise, see the MSDN Library.

适用于