IDataAdviseHolder
The IDataAdviseHolder
interface contains methods that create and manage advisory connections between
a data object and one or more advise sinks. Its methods are intended to be used
to implement the advisory methods of IDataObject. IDataAdviseHolder
is implemented on an advise holder object. Its methods establish and delete
data advisory connections and send notification of change in data from a data
object to an object that requires this notification, such as an OLE container,
which must contain an advise sink.
Advise sinks
are objects that require notification of change in the data the object contains
and implement the IAdviseSink
interface. Advise sinks are also usually associated with OLE compound document
containers.
When to implement
Typically,
you use the OLE-provided implementation of IDataAdviseHolder to simplify
your implementation of the DAdvise, DUnadvise, and EnumDAdvise
methods in the IDataObject
interface, and to send notification of data change as appropriate. It would be
necessary to implement IDataAdviseHolder only in the case where there
may be a need for a custom data advise holder object, whose methods are to be
used to implement the IDataObject methods in a set of servers.
When to use
Your
implementation of the advisory methods of IDataObject can call the methods in IDataAdviseHolder.
The first time you receive a call to IDataObject::DAdvise, call the function CreateDataAdviseHolder to create an instance of
the OLE-provided advise holder and get a pointer to its IDataAdviseHolder
interface. Then, in implementing the IDataObject interface on the data
object, you delegate implementations of the DAdvise, DUnadvise,
and EnumDAdvise methods to the corresponding methods in IDataAdviseHolder.
When the data
of interest to an advise sink actually changes, you call IDataAdviseHolder::SendOnDataChange from the data object to
carry out the necessary notifications.
Methods in VTable Order
|
IUnknown Methods |
Description |
|
QueryInterface |
Returns
pointers to supported interfaces. |
|
AddRef |
Increments
reference count. |
|
Release |
Decrements
reference count. |
|
IDataAdviseHolder
Methods |
Description |
|
Advise |
Creates a
connection between an advise sink and a data object so the advise sink can
receive notification of change in the data object. |
|
Unadvise |
Destroys a
notification connection previously set up with the Advise method. |
|
EnumAdvise |
Returns an
object that can be used to enumerate the current advisory connections. |
|
SendOnDataChange |
Sends a
change notification back to each advise sink that is currently being managed. |
See Also