Creates a connection between an advise sink and a data object for receiving notifications.
HRESULT Advise(
IDataObject * pDataObject, //Pointer to the data object for which
// notifications are requested
FORMATETC * pFormatetc, //Pointer to the description of data to
// the advise sink
DWORD advf, //Flags that specify how the notification
// takes place
IAdviseSink * pAdvSink, //Pointer to the advise sink requesting
// notification
DWORD * pdwConnection //Pointer to the connection token
);
ADVF Value | Description |
---|---|
ADVF_NODATA | Asks that no data be sent along with the notification. |
ADVF_ONLYONCE | Causes the advisory connection to be destroyed after the first notification is sent. An implicit call to IDataAdviseHolder::Unadvise is made on behalf of the caller to remove the connection. |
ADVF_PRIMEFIRST | Causes an initial notification to be sent regardless of whether or not data has changed from its current state. |
ADVF_DATAONSTOP | When specified with ADVF_NODATA, this flag causes a last notification with the data included to be sent before the data object is destroyed. When ADVF_NODATA is not specified, this flag has no effect. |
This method supports the standard return value E_INVALIDARG, as well as the following:
Through the connection established through this method, the advisory sink can receive future notifications in a call to IAdviseSink::OnDataChange.
An object issues a call to IDataObject::DAdvise to request notification on changes to the format, medium, or target device of interest. This data is specified in the pFormatetc parameter. The DAdvise method is usually implemented to call IDataAdviseHolder::Advise to delegate the task of setting up and tracking a connection to the advise holder. When the format, medium, or target device in question changes, the data object calls IDataAdviseHolder::SendOnDataChange to send the necessary notifications.
The established connection can be deleted by passing the value in pdwConnection in a call to IDataAdviseHolder::Unadvise.
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in objidl.h.
ADVF, CreateDataAdviseHolder, FORMATETC, IDataAdviseHolder::Unadvise, IDataObject::DAdvise