HlinkCreateFromMoniker function

[HlinkCreateFromMoniker 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 new system hyperlink object from a moniker, a location string, and a friendly name string that is used to display the hyperlink.


HRESULT HlinkCreateFromMoniker(
  _In_  IMoniker   *pimkTrgt,
  _In_  LPCWSTR    pwzLocation,
  _In_  LPCWSTR    pwzFriendlyName,
  _In_  IHlinkSite *pihlsite,
  _In_  DWORD      dwSiteData,
  _In_  IUnknown   *piunkOuter,
  _In_  REFIID     riid,
  _Out_ Void       *ppvObj


  • pimkTrgt [in]
    The address of the moniker to the hyperlink target for the new hyperlink. This must not be NULL.

  • pwzLocation [in]
    The address of a named location in the hyperlink target that resolves to the hyperlink reference.

  • pwzFriendlyName [in]
    The address of a string to use as the display name for the hyperlink.

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

  • dwSiteData [in]
    The additional site data for the new hyperlink object.

  • 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 non-NULL.

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

Return value

Returns S_OK if successful.


HlinkCreateFromMoniker is one of three helper functions that you can use to create a hyperlink. HlinkCreateFromData creates a hyperlink from a Component Object Model (COM) object that supports both the IDataObject interface and a hyperlink format CF_HYPERLINK on that IDataObject interface. HlinkQueryCreateFromData is called before the call to HlinkCreateFromData to determine if both 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.

HlinkCreateFromMoniker creates new hyperlinks from an existing target moniker, a location string in the target, and a friendly name string that is used to identify how to display the hyperlink. This method is used as part of a user interface to create new hyperlinks from existing hyperlinks, or to edit existing hyperlinks, using a dialog box or form to prompt for the strings. This function is significantly faster than HlinkCreateFromString.


Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server