IHlink

The IHlink interface enables a COM object known as a hyperlink to completely encapsulate the behavior of navigating to its target location.

Hyperlinks are managed by COM hyperlink container objects, which support the IHlinkSite interface for hyperlinks within the container and the IHlinkTarget interface for hyperlinks referring to documents or document objects within it.

IHlink provides methods for a hyperlink object to navigate to its target, access a friendly name for display purposes, and identify itself to its container and frame.

When to Implement

Typically, you do not need to implement this interface. A standard implementation of a hyperlink component is provided as part of the system, and it is not advisable to implement another version. A document can use the standard hyperlink object to represent hyperlinks within itself, thus encapsulating the capability of navigating, saving, loading, dragging, dropping, cutting, and pasting hyperlinks. The standard hyperlink object implements IHlink, IPersistStream, and IDataObject interfaces.

The support for IPersistStream means that hyperlink objects may be saved to or loaded from a stream, and the support for IDataObject means that hyperlink objects may be cut and pasted.

When to Use

IHlink interfaces are typically called by an application's hyperlink container as part of a user interface for creating new hyperlinks. Standard hyperlink objects are created via the HlinkCreateFromData, HlinkCreateFromMoniker, HlinkCreateFromString, and OleLoadFromStream functions.

While the hyperlink object provides many useful functions that are needed for general purpose uses, often applications are only interested in navigating to a hyperlink target. For simple navigation needs, there are a number of "helper" functions such as HlinkSimpleNavigateToString, HlinkSimpleNavigateToMoniker, and HlinkNavigateToStringReference that allow simple hyperlink navigation without any knowledge of other hyperlink interfaces or objects.

Hyperlink navigation involves transitioning from one document/object/application, known as the hyperlink container, to another document/object/application, known as the hyperlink target. Usually, both remain running, but the hyperlink target visually replaces the hyperlink container (from which the navigation originated). There are three "flavors" of hyperlink containers and targets.

  1. Top-level documents.
  2. ActiveX Document objects in a browser.
  3. ActiveX Document objects in an Office Binder-like application that does not support OLE in-place/DocObj server functionality, and hence cannot be shown in-place in a browser.

The following are possible forms of navigation:

  1. From one top-level document to another top-level document (for example, between Office documents in the absence of a browser).
  2. From a top-level document to an ActiveX Document in a browser (for example, from a stand-alone application to an HTML document).
  3. From one ActiveX document object in a browser to another ActiveX document object in the same browser (for example, one HTML document to another).
  4. From one ActiveX document object in a browser to an ActiveX document object in a Binder-type application (for example, if the hyperlink target is embedded as an ActiveX Document Object in an Office Binder document; in this scenario, the end user model gets complicated and confusing if the embedded ActiveX Document Object is shown in the browser's window, instead of letting it appear in its own container's window).
  5. From one location in an object/document to another location in the same object/document (applicable to all three flavors of hyperlink containers/hyperlink targets).

Methods in Vtable Order

IUnknown Methods Description
QueryInterface Returns pointers to supported interfaces.
AddRef Increments reference count.
Release Decrements reference count.

IHlink Methods Description
SetHlinkSite Saves the interface pointer on the site object.
GetHlinkSite Retrieves the interface pointer on the site object.
SetMonikerReference Sets the moniker reference of the target.
GetMonikerReference Retrieves the moniker and location portions of the target.
SetStringReference Sets the name and location portions of the target.
GetStringReference Retrieves the name and location portions of the target.
SetFriendlyName Sets the friendly name of the target.
GetFriendlyName Retrieves the friendly name of the target.
SetTargetFrameName Sets the name of the target frame.
GetTargetFrameName Retrieves the name of the target frame.
GetMiscStatus Queries if hyperlink is absolute or relative.
Navigate Navigates to the given target.
SetAdditionalParams Sets additional hyperlink parameters.
GetAdditionalParams Retrieves additional hyperlink parameters.

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in hlink.h.

See Also

HlinkNavigateToStringReference, HlinkSimpleNavigateToMoniker, HlinkSimpleNavigateToString