Partager via


IOleLink::GetSourceMoniker

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This method retrieves the moniker identifying the link source of a linked object.

Syntax

HRESULT GetSourceMoniker(
  IMoniker** ppmk 
);

Parameters

  • ppmk
    [out] Address of the IMoniker* pointer variable that receives the interface pointer to an absolute moniker that identifies the link source.

    When successful, the implementation must call the IUnknown::AddRef method on *ppmk; it is the caller's responsibility to call IUnknown::Release.

    If an error occurs, the implementation must set *ppmk to NULL.

Return Value

If the method succeeds, the return value is S_OK.

If no moniker is available, the method returns MK_E_UNAVAILABLE.

Remarks

The linked object stores both an absolute and a relative moniker for the link source.

If the relative moniker is non-NULL and a moniker is available for the compound document, IOleLink::GetSourceMoniker returns the moniker created by composing the relative moniker onto the end of the compound document's moniker. Otherwise, it returns the absolute moniker or, if an error occurs, NULL.

The container specifies the absolute moniker when it calls one of the OleCreateLink functions to create a link.

The application can call the IOleLink::SetSourceMoniker or IOleLink::SetSourceDisplayName method to change the absolute moniker. In addition, the linked object automatically updates the monikers whenever it successfully binds to the link source or when it is bound to the link source and it receives a rename notification through the IAdviseSink::OnRename method.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Notes to Callers

Your container application can call IOleLink::GetSourceMoniker to display the current source of a link in the Links dialog box.

Note that this requires your container to use the IMoniker::GetDisplayName method to get the display name of the moniker.

If you would rather get the display name directly, your container can call IOleLink::GetSourceDisplayName instead of IOleLink::GetSourceMoniker.

Requirements

Header Oleidl.h, oleidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

IMoniker
IAdviseSink::OnRename
IMoniker::GetDisplayName
IOleLink::SetSourceDisplayName
IOleLink::SetSourceMoniker
IUnknown::AddRef
IUnknown::Release