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.
HRESULT CommonPrefixWith(
IMoniker *pmkOther, //Pointer to moniker to be used for
//comparison
IMoniker **ppmkPrefix //Address of output variable that receives
//the IMoniker interface pointer
);
The method supports the standard return value E_OUTOFMEMORY, as well as the following:
IMoniker::CommonPrefixWith creates a new moniker that consists of the common prefixes of the moniker on this moniker object and another moniker. If, for example, one moniker represents the path "c:\projects\secret\art\pict1.bmp" and another moniker represents the path "c:\projects\secret\docs\chap1.txt," the common prefix of these two monikers would be a moniker representing the path "c:\projects\secret."
The IMoniker::CommonPrefixWith method is primarily called in the implementation of the IMoniker::RelativePathTo method. Clients using a moniker to locate an object rarely need to call this method.
Call this method only if pmkOther and this moniker are both absolute monikers. An absolute moniker is either a file moniker or a generic composite whose leftmost component is a file moniker that represents an absolute path. Do not call this method on relative monikers, because it would not produce meaningful results.
Your implementation should first determine whether pmkOther is a moniker of a class that you recognize and for which you can provide special handling (for example, if it is of the same class as this moniker). If so, your implementation should determine the common prefix of the two monikers. Otherwise, it should pass both monikers in a call to the MonikerCommonPrefixWith function, which correctly handles the generic case.
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in objidl.h.
IMoniker::RelativePathTo, MonikerCommonPrefixWith