IMoniker 接口


提供 IMoniker 接口的托管定义,具有 IPersistIPersistStream 中的 COM 功能。Provides the managed definition of the IMoniker interface, with COM functionality from IPersist and IPersistStream.

public interface class IMoniker
public interface IMoniker
type IMoniker = interface
Public Interface IMoniker


有关IMonikerIPersist和接口的详细信息,请参阅MSDNlibrary。IPersistStreamFor more information about the IMoniker, IPersist, and IPersistStream interfaces, see the MSDN Library.

当本机代码中的 COM 方法返回 HRESULT 时,公共语言运行时将引发异常。The common language runtime throws an exception when a COM method in native code returns an HRESULT. 有关更多信息,请参见 How to: Map HRESULTs and ExceptionsFor more information, see How to: Map HRESULTs and Exceptions.


BindToObject(IBindCtx, IMoniker, Guid, Object)

使用名字对象绑定到它所标识的对象。Uses the moniker to bind to the object that it identifies.

BindToStorage(IBindCtx, IMoniker, Guid, Object)

检索指向存储(该存储包含名字对象所标识的对象)的接口指针。Retrieves an interface pointer to the storage that contains the object identified by the moniker.

CommonPrefixWith(IMoniker, IMoniker)

基于此名字对象与另一名字对象共有的公共前缀创建新的名字对象。Creates a new moniker based on the common prefix that this moniker shares with another moniker.

ComposeWith(IMoniker, Boolean, IMoniker)

将当前名字对象与另一名字对象组合,创建一个新的复合名字对象。Combines the current moniker with another moniker, creating a new composite moniker.

Enum(Boolean, IEnumMoniker)

提供一个指向枚举器(该枚举器可枚举复合名字对象的组件)的指针。Supplies a pointer to an enumerator that can enumerate the components of a composite moniker.


检索对象的类标识符 (CLSID)。Retrieves the class identifier (CLSID) of an object.

GetDisplayName(IBindCtx, IMoniker, String)

获取显示名称,该名称是当前名字对象的用户可读表示形式。Gets the display name, which is a user-readable representation of the current moniker.


返回保存该对象所需的流的大小(以字节为单位)。Returns the size, in bytes, of the stream needed to save the object.

GetTimeOfLastChange(IBindCtx, IMoniker, FILETIME)

提供一个数字,该数字表示当前名字对象所标识的对象的上次更改时间。Provides a number representing the time that the object identified by the current moniker was last changed.


使用该名字对象的内部状态计算 32 位整数。Calculates a 32-bit integer using the internal state of the moniker.


提供一个名字对象,该名字对象在被复合到当前名字对象或一个结构相似的名字对象的右边时,将不复合到任何对象。Provides a moniker that, when composed to the right of the current moniker or one of similar structure, composes to nothing.


检查该对象自上次保存以来所发生的更改。Checks the object for changes since it was last saved.


将当前名字对象与指定的名字对象进行比较,并指示它们是否相同。Compares the current moniker with a specified moniker and indicates whether they are identical.

IsRunning(IBindCtx, IMoniker, IMoniker)

确定由当前名字对象标识的对象当前是否已加载并正在运行。Determines whether the object that is identified by the current moniker is currently loaded and running.


指示此名字对象是否属于系统提供的名字对象类之一。Indicates whether this moniker is of one of the system-supplied moniker classes.


从以前保存对象的流中初始化对象。Initializes an object from the stream where it was previously saved.

ParseDisplayName(IBindCtx, IMoniker, String, Int32, IMoniker)

读取指定的显示名称中 ParseDisplayName(IBindCtx, IMoniker, String, Int32, IMoniker) 能够理解的全部字符并生成一个与读取的部分相对应的名字对象。Reads as many characters of the specified display name as the ParseDisplayName(IBindCtx, IMoniker, String, Int32, IMoniker) understands and builds a moniker corresponding to the portion read.

Reduce(IBindCtx, Int32, IMoniker, IMoniker)

返回简化的名字对象,它是与当前名字对象引用同一对象但能够用相等或更高的效率绑定的另一个名字对象。Returns a reduced moniker, which is another moniker that refers to the same object as the current moniker but can be bound with equal or greater efficiency.

RelativePathTo(IMoniker, IMoniker)

提供一个名字对象,该名字对象在被追加到当前名字对象(或一个有相似结构的名字对象)时生成指定名字对象。Supplies a moniker that, when appended to the current moniker (or one with a similar structure), yields the specified moniker.

Save(IStream, Boolean)

将对象保存到指定流。Saves an object to the specified stream.