Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MonikerRelativePathTo function

Provides a moniker that, when composed onto the end of the first specified moniker (or one with a similar structure), yields the second specified moniker.

This function is intended for use only by IMoniker::RelativePathTo implementations.


HRESULT MonikerRelativePathTo(
  _In_  LPMONIKER pmkSrc,
  _In_  LPMONIKER pmkDest,
  _Out_ LPMONIKER *ppmkRelPath,
  _In_  BOOL      dwReserved


pmkSrc [in]

A pointer to the IMoniker interface on the moniker that, when composed with the relative moniker to be created, produces pmkDest. This moniker identifies the "source" of the relative moniker to be created.

pmkDest [in]

A pointer to the IMoniker interface on the moniker to be expressed relative to pmkSrc. This moniker identifies the destination of the relative moniker to be created.

ppmkRelPath [out]

The address of an IMoniker* pointer variable that receives the interface pointer to the new relative moniker. When successful, the function has called AddRef on the moniker and the caller is responsible for calling Release. If an error occurs, the interface pointer value is NULL.

dwReserved [in]

This parameter is reserved and must be nonzero.

Return value

This function can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following values.

Return codeDescription

A meaningful relative path has been returned.


The only form of the relative path is the other moniker.


The pmkSrc parameter is a relative moniker, such as an item moniker, and must be composed with the moniker of its container before a relative path can be determined.



Your implementation of IMoniker::RelativePathTo should first check whether the other moniker is of a type you recognize and handle in a special way. If not, you should call MonikerRelativePathTo, passing itself as pmkThis and the other moniker as pmkOther. MonikerRelativePathTo correctly handles the cases where either moniker is a generic composite.

You should call this function only if pmkSrc and pmkDest are both absolute monikers, where an absolute moniker is either a file moniker or a generic composite whose leftmost component is a file moniker, and where the file moniker represents an absolute path. Do not call this function on relative monikers.


Minimum supported client

Windows 2000 Professional [desktop apps | UWP apps]

Minimum supported server

Windows 2000 Server [desktop apps | UWP apps]







See also




© 2017 Microsoft