HlinkCreateFromMoniker

Creates a new system hyperlink object from a moniker, a location string, and a friendly name string (used for displaying the hyperlink).

HRESULT HlinkCreateFromMoniker(

IMoniker * pimkTrgt,

//Interface on hyperlink target moniker

LPCWSTR pwzLocation,

//Named location of hyperlink reference within target

LPCWSTR pwzFriendlyName,

//Display name of hyperlink

IHlinkSite * pihlsite,

//Interface on hyperlink site

DWORD dwSiteData,

//Additional site data

IUnknown * piunkOuter,

//Whether or not object is part of an aggregate

REFIID riid,

//Interface identifier on new hyperlink object

Void * ppvObj

//Receives the requested interface’s pointer

);

Parameters

pimkTrgt
[in] A pointer to the moniker to the hyperlink target for the new hyperlink. Must not be NULL.
pwzLocation
[in] Pointer to a named location within the hyperlink target which resolves to the hyperlink reference.
pwzFriendlyName
[in] Pointer to a string to use as the display name for the hyperlink.
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 hyperlink object. If NULL, the new hyperlink object 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 successfully.

Remarks

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

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

See Also

HlinkCreateFromData, HlinkCreateFromString, HlinkQueryCreateFromData