Share via


MonikerCommonPrefixWith

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.

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

Parameters

  • pmkThis
    [in] Pointer to the IMoniker interface 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 IMoniker interface 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 pmkThis and pmkOther. When successful, the function has called IUnknown::AddRef on the moniker and the caller is responsible for calling IUnknown::Release. If an error occurs, the supplied interface pointer value is NULL.

Return Values

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 pmkThis nor pmkOther.
  • MK_S_HIM
    The entire pmkOther moniker is a prefix of the pmkThis moniker.
  • MK_S_ME
    The entire pmkThis moniker is a prefix of the pmkOther moniker.
  • MK_S_US
    The pmkThis and pmkOther monikers 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 MonikerCommonPrefixWith only in the implementation of IMoniker::CommonPrefixWith for a new moniker class.

Your implementation of IMoniker::CommonPrefixWith should 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 pmkThis and the other moniker as pmkOther. MonikerCommonPrefixWith correctly handles the cases where either moniker is a generic composite.

You should call this function only if pmkThis and pmkOther 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.

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

Requirements

OS Versions: Windows CE 3.0 and later.
Header: Objbase.h.
Link Library: Ole32.lib.

See Also

IMoniker::CommonPrefixWith

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.