HlinkCreateFromData function

[HlinkCreateFromData may be altered or unavailable in subsequent versions of the operating system or product.]

Note The Microsoft ActiveX Hyperlink API is deprecated in Windows Internet Explorer 8 and later, and ActiveX technology as a whole is unsupported in the Microsoft Edge browser in favor of standards-based web APIs. For more information, see Saying goodbye to ActiveX, VBScript, attachEvent... and Get ready for plug-in free browsing.

Creates a standard hyperlink object from a Component Object Model (COM) object that supports the IDataObject interface.


HRESULT HlinkCreateFromData(
  _In_  IDataObject *piDataObj,
  _In_  IHlinkSite  *pihlsite,
  _In_  DWORD       dwSiteData,
  _In_  IUnknown    *piunkOuter,
  _In_  REFIID      riid,
  _Out_ Void        **ppvObj


  • piDataObj [in]
    The address of the IDataObject interface on the data object of interest. This is used to access the methods to retrieve the data from the object.

  • pihlsite [in]
    The address of the IHlinkSite interface for the new hyperlink in its container.

  • dwSiteData [in]
    The additional site data associated with the hyperlink site.

  • piunkOuter [in]
    The address of the controlling IUnknown interface for the new hyperlink object. If NULL, the new hyperlink object is not aggregated.

  • riid [in]
    The interface to return on the new hyperlink. This is typically IID_IHlink, or IID_IUnknown when piunkOuter is not NULL.

  • ppvObj [out]
    An indirect pointer to the requested interface.

Return value

Returns S_OK if the new hyperlink object was created successfully, or E_NOINTERFACE if the object does not support the riid interface.


This object originates from a data transfer operation, such as copying to the clipboard and pasting from the clipboard, or a drag-and-drop operation.

HlinkCreateFromData is one of three helper functions that you can use to create a hyperlink. HlinkCreateFromData creates a hyperlink from a COM object that supports both the IDataObject interface and a hyperlink format CF_HYPERLINK on that IDataObject interface. Call HlinkQueryCreateFromData before you call HlinkCreateFromData to determine if both of these conditions are met.

Use HlinkCreateFromMoniker to create a hyperlink from a COM object when you know the moniker of the object. Use HlinkCreateFromString to create a hyperlink from a COM object when you know the name of the object but not the moniker.

HlinkCreateFromData is used by a hyperlink container as part of a user interface that creates new hyperlinks through the clipboard or a drag-and-drop operation.


Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server