# HlinkCreateFromString

Creates a new hyperlink object from strings representing the hyperlink target, the location within the target, and a friendly name.

HRESULT HlinkCreateFromString(

LPCWSTR pwzTarget, | //String helping to identify the hyperlink target
LPCWSTR pwzLocation, | //Location within the hyperlink target of new hyperlink object
LPCWSTR pwzFriendlyName, | //Friendly name of the hyperlink
IHlinkSite * pihlsite, | //Site for the new hyperlink object
DWORD dwSiteData, | //Additional site data for the new hyperlink object
IUnknown * piunkOuter, | //Whether or not object is part of an aggregate
REFIID riid, | //Interface identifier on new browse context object
Void * ppvObj | //Location of the requested interface’s pointer
); |

Parameters

pwzTarget
  [in] Pointer to the string to help identify the hyperlink target. This string is resolved into a moniker via MkParseDisplayNameEx.
pwzLocation
  [in] Pointer to the string representing the location within the hyperlink target for the new hyperlink. Must not be NULL.
pwzFriendlyName
  [in] Pointer to the string to use as the friendly name for the hyperlink. This is typically a display name referenced by the user interface.
pihlsite
  [in] Pointer to the IHlinkSite object for the new hyperlink within the hyperlink container.
dwSiteData
  [in] Additional site data for the new hyperlink object.
piunkOuter
  [in] Pointer to the controlling IUnknown interface for the new browse context. If NULL, the new browse context is not aggregated.
riid
  [in] Identifies the interface to return on the new hyperlink. Typically IID_IHlink, or IID_IUnknown when punkOuter is non-NULL.
ppvObj
  [out] On return, indirect pointer to the requested interface.

Return Values

S_OK
  A new hyperlink object was created.

Remarks

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

To create a hyperlink from a COM object for which you know the moniker, use HlinkCreateFromMoniker. To create a hyperlink from a COM object for which you have the name but not the moniker, use HlinkCreateFromString.

HlinkCreateFromString is typically used by hyperlink containers as part of the user interface for creating brand new hyperlinks, where the user fills in a form or dialog box of items -- target, location, friendly name -- which are used to construct the hyperlink.

See Also

HlinkCreateFromData, HlinkCreateFromMoniker, HlinkQueryCreateFromData