Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function creates and supplies a new anti-moniker.

Syntax

WINOLEAPI CreateAntiMoniker(
  LPMONIKER FAR* 
ppmk
);

Parameters

ppmk

[out] Address of IMoniker* pointer variable that receives the interface pointer to the new anti-moniker. When successful, the function has called IUnknown::AddRefon the anti-moniker and the caller is responsible for calling IUnknown::Release. When an error occurs, the anti-moniker pointer is NULL.

Return Value

This function supports the standard return value E_OUTOFMEMORY, as well as the following:

S_OK

The anti-moniker has been created successfully.

Remarks

Your application will call this function only when you are implementing your own moniker ( IMonikerinterface). If the new moniker class has no internal structure, it can use CreateAntiMonikerin the implementation of the IMoniker::Inversemethod, and then check for an anti-moniker in the implementation of IMoniker::ComposeWith.

Like the ".." directory in MS-DOS file systems, which acts as the inverse to any directory name just preceding it in a path, an anti-moniker acts as the inverse of a simple moniker that precedes it in a composite moniker.

An anti-moniker is used as the inverse of simple monikers with no internal structure. For example, the system-provided implementations of file monikers, item monikers, and pointer monikers all use anti-monikers as their inverse; consequently, an anti-moniker composed to the right of one of these monikers composes to nothing.

A moniker client (an object that is using a moniker to bind to another object) typically does not know the class of a given moniker, so the client cannot be sure that an anti-moniker is the inverse. Therefore, to get the inverse of a moniker, the client will call IMoniker::Inverserather than CreateAntiMoniker.

To remove the last piece of a composite moniker, the client will do the following:

  1. Call IMoniker::Enumon the composite, specifying FALSE as the first parameter. This creates an enumerator that returns the component monikers in reverse order.

  2. Use the enumerator to retrieve the last piece of the composite.

  3. Call IMoniker::Inverseon that moniker. The moniker returned by IMoniker::Inversewill remove the last piece of the composite.

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

Requirements

Header objbase.h
Library ole32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

COM Functions