IAdviseSink interface

Enables containers and other objects to receive notifications of data changes, view changes, and compound-document changes occurring in objects of interest. Container applications, for example, require such notifications to keep cached presentations of their linked and embedded objects up-to-date. Calls to IAdviseSink methods are asynchronous, so the call is sent and then the next instruction is executed without waiting for the call's return.

For an advisory connection to exist, the object that is to receive notifications must implement IAdviseSink, and the objects in which it is interested must implement IOleObject::Advise and IDataObject::DAdvise. In-process objects and handlers may also implement IViewObject::SetAdvise. Objects implementing IOleObject must support all reasonable advisory methods. To simplify advisory notifications, OLE supplies implementations of the IDataAdviseHolder and IOleAdviseHolder, which keep track of advisory connections and send notifications to the proper sinks through pointers to their IAdviseSink interfaces. IViewObject (and its advisory methods) is implemented in the default handler.

As shown in the following table, an object that has implemented an advise sink registers its interest in receiving certain types of notifications by calling the appropriate method.

Call This Method To Register for These Notifications
IOleObject::Advise When a document is saved, closed, or renamed.
IDataObject::DAdvise When a document's data changes.
IViewObject::SetAdvise When a document's presentation changes.
 

When an event occurs that applies to a registered notification type, the object application calls the appropriate IAdviseSink method. For example, when an embedded object closes, it calls the IAdviseSink::OnClose method to notify its container. These notifications are asynchronous, occurring after the events that trigger them.

Methods

The IAdviseSink interface has these methods.

Method Description
IAdviseSink::OnClose Called by the server to notify all registered advisory sinks that the object has changed from the running to the loaded state.
IAdviseSink::OnDataChange Called by the server to notify a data object's currently registered advise sinks that data in the object has changed.
IAdviseSink::OnRename Called by the server to notify all registered advisory sinks that the object has been renamed.
IAdviseSink::OnSave Called by the server to notify all registered advisory sinks that the object has been saved.
IAdviseSink::OnViewChange Notifies an object's registered advise sinks that its view has changed.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header objidl.h

See Also

IAdviseSink2

IAdviseSinkEx

IDataAdviseHolder

IDataObject::DAdvise

IOleAdviseHolder

IOleObject::Advise

IUnknown

IViewObject::SetAdvise