The IAdviseSink2 interface is an extension of IAdviseSink, adding the method OnLinkSrcChange to the contract to handle a change in the moniker of a linked object. This avoids overloading the implementation IAdviseSink::OnRename to handle the renaming of both embedded objects and linked objects. In applications where different blocks of code might execute depending on which of these two similar events has occurred, using the same method for both events complicates testing and debugging.
If your application supports links, you should definitely implement IAdviseSink2. Even if your application does not support links, it may do so in future releases. In general, your code would implement just IAdviseSink2, which, because of contract inheritance, must include implementations of all of the IAdviseSink methods, along with the single additional method of IAdviseSink2.
When a link source is renamed, the link object should notify its container by calling IAdviseSink::OnLinkSrcChange. If you are using the default handler, containing the OLE link object, you can still have both embedded and linked objects call IAdviseSink::OnRename, but for linked objects, the OLE link object maps the notification to IAdviseSink2::OnLinkSrcChange.
IUnknown Methods | Description |
---|---|
QueryInterface | Returns pointers to supported interfaces. |
AddRef | Increments reference count. |
Release | Decrements reference count. |
IAdviseSink Methods | Description |
---|---|
OnDataChange | Advises that data has changed. |
OnViewChange | Advises that view of object has changed. |
OnRename | Advises that name of object has changed. |
OnSave | Advises that object has been saved to disk. |
OnClose | Advises that object has been closed. |
IAdviseSink2 Method | Description |
---|---|
OnLinkSrcChange | Advises that link source has changed. |
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in objidl.h.