Export (0) Print
Expand All

HlinkCreateFromString Function

Deprecated. Creates a new hyperlink object from strings that represent the hyperlink target, the location in the target, and a friendly name.


HRESULT HlinkCreateFromString(
    LPCWSTR pwzTarget,
    LPCWSTR pwzLocation,
    LPCWSTR pwzFriendlyName,
    IHlinkSite *pihlsite,
    DWORD dwSiteData,
    IUnknown *piunkOuter,
    REFIID riid,
    Void *ppvObj


[in] The address of the string to help identify the hyperlink target. This string is resolved into a moniker by using MkParseDisplayNameEx.
[in] The address of the string that represent the location in the hyperlink target for the new hyperlink. This must not be NULL.
[in] Address of the string to use as the friendly name for the hyperlink. This is a display name referenced by the user interface.
[in] The address of the IHlinkSite object for the new hyperlink in the hyperlink container.
[in] The additional site data for the new hyperlink object.
[in] The address of the controlling IUnknown interface for the new browse context. If NULL, the new browse context is not aggregated.
[in] The interface to return on the new hyperlink. This is IID_IHlink, or IID_IUnknown when piunkOuter is not NULL.
[out] An indirect pointer to the requested interface.

Return Value

Returns S_OK if a new hyperlink object was created.


HlinkCreateFromString 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.

HlinkCreateFromString is used by hyperlink containers as part of the user interface to create new hyperlinks. The user fills in a form or dialog box of items—target, location, friendly name—that are used to construct the hyperlink.

security note Security Alert  Never pass strings from a non-trusted source. When creating a hyperlink with HlinkCreateFromString, the pwzTarget parameter is passed to MkParseDisplayNameEx. This call is safe, but the less safe MkParseDisplayName will be called for the string under the following circumstances:
  • Not a file or URL string.
  • Does not contain a colon or forward slash.
  • Less than 256 characters.
A pwzTarget string of the form "@progid!extra" will instantiate the object registered with the specified progid and, if it implements the IMoniker interface, invoke IMoniker::ParseDisplayName with the "extra" string. A malicious object could use this opportunity to run unexpected code.

Function Information

Stock Implementation Hlink.dll
Custom Implementation No
Header Hlink.h
Import library Hlink.lib
Minimum availability Internet Explorer 3.0
Minimum operating systems Windows NT 4.0, Windows 95

Community Additions

© 2014 Microsoft