Skip to content

Latest commit

 

History

History
107 lines (73 loc) · 5.93 KB

nf-oleidl-iolelink-setsourcemoniker.md

File metadata and controls

107 lines (73 loc) · 5.93 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:oleidl.IOleLink.SetSourceMoniker
IOleLink::SetSourceMoniker (oleidl.h)
Sets the moniker for the link source.
IOleLink interface [COM]
SetSourceMoniker method
IOleLink.SetSourceMoniker
IOleLink::SetSourceMoniker
SetSourceMoniker
SetSourceMoniker method [COM]
SetSourceMoniker method [COM]
IOleLink interface
_ole_iolelink_setsourcemoniker
com.iolelink_setsourcemoniker
oleidl/IOleLink::SetSourceMoniker
com\iolelink_setsourcemoniker.htm
com
85fe1d28-d9c6-46b4-abff-6afce9ff3cd0
12/05/2018
IOleLink interface [COM],SetSourceMoniker method, IOleLink.SetSourceMoniker, IOleLink::SetSourceMoniker, SetSourceMoniker, SetSourceMoniker method [COM], SetSourceMoniker method [COM],IOleLink interface, _ole_iolelink_setsourcemoniker, com.iolelink_setsourcemoniker, oleidl/IOleLink::SetSourceMoniker
oleidl.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
OleIdl.Idl
Windows
19H1
IOleLink::SetSourceMoniker
oleidl/IOleLink::SetSourceMoniker
c++
APIRef
kbSyntax
COM
OleIdl.h
IOleLink.SetSourceMoniker

IOleLink::SetSourceMoniker

-description

Sets the moniker for the link source.

-parameters

-param pmk [in]

A pointer to the IMoniker interface on a moniker that identifies the new link source of the linked object. A value of NULL breaks the link.

-param rclsid [in]

The CLSID of the link source that the linked object should use to access information about the linked object when it is not bound.

-returns

This method returns S_OK on success.

-remarks

Notes to Callers

Your container application can call IOleLink::SetSourceMoniker when the end user changes the source of a link or breaks a link. Note that this requires your container to use the MkParseDisplayName function to create a moniker out of the display name that the end user enters. If you'd rather have the linked object perform the parsing, your container can call IOleLink::SetSourceDisplayName instead of IOleLink::SetSourceMoniker.

The end user changes the source of a link or breaks a link using the Links dialog box. If you use the OleUIEditLinks function to display the Links dialog box, you must implement the IOleUILinkContainer interface. The dialog box calls your implementations of IOleUILinkContainer::SetLinkSource and IOleUILinkContainer::CancelLink; your implementation of these methods can call IOleLink::SetSourceMoniker.

If the linked object is currently bound to its link source, the linked object's implementation of IOleLink::SetSourceMoniker closes the link before changing the moniker.

Notes to Implementers

The IOleLink contract does not specify how the linked object stores or uses the link source moniker. The provided implementation stores the absolute moniker specified when the link is created or when the moniker is changed; it then computes and stores a relative moniker. Future implementations might manage monikers differently to provide better moniker tracking. The absolute moniker provides the complete path to the link source. The linked object uses this absolute moniker and the moniker of the compound document to compute a relative moniker that identifies the link source relative to the compound document that contains the link.

pmkCompoundDoc->RelativePathTo(pmkAbsolute, ppmkRelative)

When binding to the link source, the linked object first tries to bind using the relative moniker. If that fails, it tries to bind the absolute moniker.

When the linked object successfully binds using either the relative or the absolute moniker, it automatically updates the other moniker. The linked object also updates both monikers when it is bound to the link source and it receives a rename notification through the IAdviseSink::OnRename method. A container application can also use the IOleLink::SetSourceDisplayName method to change a link's moniker.

The linked object's implementation of IPersistStorage::Save saves both the relative and the absolute moniker.

-see-also

IOleLink

IOleLink::GetSourceMoniker

IOleLink::SetSourceDisplayName

IOleUILinkContainer

OleUIEditLinks