The IMoniker interface of the com.ms.com package contains methods that allow you to use a moniker object, which contains information that uniquely identifies a COM object. An object that has a pointer to the moniker object's IMoniker interface can locate, activate, and get access to the identified object without having any other specific information on where the object is actually located in a distributed system.
Like a path to a file in a file system, a moniker contains information that allows a COM object to be located and activated. Monikers can identify any type of COM object, from a document object stored in a file to a selection within an embedded object. COM provides a set of moniker classes that allow you to create moniker objects identifying the objects most commonly found in the system. For example, there might be an object representing a range of cells in a spreadsheet, which is itself embedded in a text document stored in a file. In a distributed system, this object's moniker would identify the location of the object's system, the file's physical location on that system, the storage of the embedded object within that file, and, finally, the location of the range of cells within the embedded object.
A moniker object supports the IMoniker interface, which is derived from the IPersistStream interface, and uniquely identifies a single object in the system. Once an object providing a moniker has created the moniker object, this information cannot be changed within that object. If the moniker provider changes the information, it can only do so by creating a new moniker object, which would then uniquely identify the object in question.
Monikers have two important capabilities:
Monikers are used as the basis for linking in COM. A linked object contains a moniker that identifies its source. When the user activates the linked object to edit it, the moniker is bound; this loads the link source into memory.
Note The IMoniker interface was added as of versions 2925 through 3167 of the Microsoft virtual machine.
public interface IMoniker extends com.ms.com.IPersistStream { // Methods public IUnknown BindToObject(IBindCtx pbc, IMoniker pmkToLeft, _Guid riidResult); public IUnknown BindToStorage(IBindCtx pbc, IMoniker pmkToLeft, _Guid riid); public IMoniker Reduce(IBindCtx pbc, int dwReduceHowFar, IMoniker[] ppmkToLeft); public IMoniker ComposeWith(IMoniker pmkRight, boolean fOnlyIfNotGeneric); public IEnumMoniker Enum(boolean fForward); public boolean IsEqual(IMoniker pmkOtherMoniker); public int Hash(); public boolean IsRunning(IBindCtx pbc, IMoniker pmkToLeft, IMoniker pmkNewlyRunning); public long GetTimeOfLastChange(IBindCtx pbc, IMoniker pmkToLeft); public IMoniker Inverse(); public void CommonPrefixWith(IMoniker pmkOther, IMoniker[] ppmkPrefix); public void RelativePathTo(IMoniker pmkOther, IMoniker[] ppmkRelPath); public String GetDisplayName(IBindCtx pbc, IMoniker pmkToLeft); public IMoniker ParseDisplayName(IBindCtx pbc, IMoniker pmkToLeft, String pszDisplayName, int[] pchEaten); public boolean IsSystemMoniker(int[] pdwMksys); } IUnknown | +--IPersistStream | | | +--IMoniker