Invoke the Links Dialog Box

After all the work to implement IOleUILinkContainer, invoking the dialog box is rather painless. This should be done in response to a Links command that should appear on your Edit menu, enabled only when links are available. Patron also includes this item on the right-mouse-button pop-up menu for an individual object (which is not part of the OLE user interface guidelines, simply my own design). In both cases, the function CPage::FQueryLinksInPage ultimately determines whether links are available by looking for tenants of type TENANTTYPE_LINKEDOBJECT. If at least one object is available, the Links item is enabled. Selecting Links invokes CPatronDoc::EditLinks.

CPatronDoc::EditLinks first obtains the CIOleUILinkContainer through CPages::GetUILinkContainer, which initializes that object with the current page's CPage pointer. On return, that object pointer is stored in an OLEUIEDITLINKS structure that is passed to OleUIEditLinks. On return from this function, the m_fDirty flag in CIOleUILinkContainer indicates to the document whether anything changed.