Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function creates a new moniker based on the common prefix that this moniker (the one comprising the data of this moniker object) shares with another moniker. This function is intended to be called only in implementations of IMoniker::CommonPrefixWith.

Syntax

WINOLEAPI MonikerCommonPrefixWith(
  LPMONIKER 
pmkThis,
  LPMONIKER 
pmkOther,
  LPMONIKER FAR* 
ppmkCommon
);

Parameters

pmkThis

[in] Pointer to the IMonikerinterface on one of the monikers for which a common prefix is sought; usually the moniker in which this call is used to implement IMoniker::CommonPrefixWith.

pmkOther

[in] Pointer to the IMonikerinterface on the other moniker to compare with the first moniker.

ppmkCommon

[out] Address of IMoniker* pointer variable that receives the interface pointer to the moniker based on the common prefix of pmkThisand pmkOther.

When successful, the function has called IUnknown::AddRefon the moniker and the caller is responsible for calling IUnknown::Release.

If an error occurs, the supplied interface pointer value is NULL.

Return Value

This function supports the standard return values E_OUTOFMEMORY and E_UNEXPECTED, as well as the following:

S_OK

A common prefix exists that is neither pmkThisnor pmkOther.

MK_S_HIM

The entire pmkOthermoniker is a prefix of the pmkThismoniker.

MK_S_ME

The entire pmkThismoniker is a prefix of the pmkOthermoniker.

MK_S_US

The pmkThisand pmkOthermonikers are equal.

MK_E_NOPREFIX

The monikers have no common prefix.

MK_E_NOTBINDABLE

This function was called on a relative moniker. It is not meaningful to take the common prefix of relative monikers.

Remarks

Call MonikerCommonPrefixWithonly in the implementation of IMoniker::CommonPrefixWithfor a new moniker class.

Your implementation of IMoniker::CommonPrefixWithshould first check whether the other moniker is of a type that you recognize and handle in a special way.

If not, you should call MonikerCommonPrefixWith, passing itself as pmkThisand the other moniker as pmkOther. MonikerCommonPrefixWithcorrectly handles the cases where either moniker is a generic composite.

You should call this function only if pmkThisand pmkOtherare 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.

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

Requirements

Header objbase.h
Library ole32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also