MonikerCommonPrefixWith

Returns a moniker based on the common prefix that the two monikers share. This function is intended for use only in IMoniker::CommonPrefixWith implementations.

WINOLEAPI MonikerCommonPrefixWith(

LPMONIKER pmkThis,
//First moniker being compared
LPMONIKER pmkOther,
//Second moniker being compared
LPMONIKER FAR *ppmkCommon
//Receives common prefix
);

Parameters

pmkThis

Points to one of the monikers to compare.

pmkOther

Points to the other moniker to compare.

ppmkCommon

Receives a pointer to a moniker based on the common prefix of pmkThis and pmkOther. The returned pointer is NULL if an error occurs; if non-NULL, the function has called IUnknown::AddRef on the parameter and the caller is responsible for calling IUnknown::Release.

Return Values

S_OK

Indicates a common prefix exists that is neither pmkThis nor pmkOther.

MK_S_HIM

Indicates the entire pmkOther moniker is a prefix of the pmkThis moniker.

MK_S_ME

Indicates the entire pmkThis moniker is a prefix of the pmkOther moniker.

MK_S_US

Indicates the pmkThis and pmkOther monikers are equal.

MK_E_NOPREFIX

Indicates the monikers have no common prefix.

MK_E_NOTBINDABLE

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

E_UNEXPECTED

Indicates an unexpected error occurred.

E_OUTOFMEMORY

Indicates insufficient memory.

Comments

Call MonikerCommonPrefixWith only if you are writing your own moniker class (implementing the IMoniker interface). Call this function from your implementation of the IMoniker::CommonPrefixWith method.

Your implementation of IMoniker::CommonPrefixWith should first check whether the other moniker is of a type 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 pmkSrc and pmkDest are both absolute monikers (where an absolute moniker is either a file moniker or a generic composite whose left-most component is a file moniker, and where the file moniker represents an absolute path). Do not call this function on relative monikers.

See Also

IMoniker::CommonPrefixWith

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples