Linking Containers Step by Step

Within the framework of the support for embedded objects that we built in Chapter 17, we can use the following steps to add support for linking to the Patron sample (CHAP20\PATRON):

Enable links in the Insert Object dialog box.

Enable linking from clipboard and drag-and-drop operations.

Distinguish between linked and embedded objects with the Show Objects command.

Manage a file moniker for the document, call IOleObject::SetMoniker, and partially implement IOleClientSite::GetMoniker.

Invoke the Links dialog, which involves implementing the IOleUILinkContainer interface, changing link sources, and breaking links intentionally.

Update links on loading a document.

After following these six steps, you will have a container ready to link to any source, including the version of Cosmo we'll see in Chapter 21.1

1 These linking features give the container the ability to work with OLE 1 linking servers as well.