[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. ]
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 hyperlink object from strings that represent the hyperlink target, the location in the target, and a friendly name.
HRESULT HlinkCreateFromString( _In_ LPCWSTR pwzTarget, _In_ LPCWSTR pwzLocation, _In_ LPCWSTR pwzFriendlyName, _In_ IHlinkSite *pihlsite, _In_ DWORD dwSiteData, _In_ IUnknown *piunkOuter, _In_ REFIID riid, _Out_ Void *ppvObj );
The address of the string to help identify the hyperlink target. This string is resolved into a moniker by using MkParseDisplayNameEx.
The address of the string that represent the location in the hyperlink target for the new hyperlink. This must not be NULL.
Address of the string to use as the friendly name for the hyperlink. This is a display name referenced by the user interface.
The address of the IHlinkSite object for the new hyperlink in the hyperlink container.
The additional site data for the new hyperlink object.
The address of the controlling IUnknown interface for the new browse context. If NULL, the new browse context is not aggregated.
The interface to return on the new hyperlink. This is IID_IHlink, or IID_IUnknown when piunkOuter is not NULL.
An indirect pointer to the requested interface.
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.
Minimum supported client
Minimum supported server
Windows 2000 Server