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 method returns the inverse of the moniker.

Syntax

HRESULT Inverse( 
  IMoniker** 
ppmk
);

Parameters

ppmk

[out] Address of IMoniker* pointer variable that receives the interface pointer to a moniker that is the inverse of this moniker.

When successful, the implementation must call the IUnknown::AddRefmethod on the new inverse moniker.

It is the caller's responsibility to call the IUnknown::Releasemethod. If an error occurs, the implementation should set * ppmkto NULL.

Return Value

The method supports the standard return value E_OUTOFMEMORY. The following table shows the additional return values for this method.

Value Description

S_OK

The inverse moniker has been returned successfully.

MK_E_NOINVERSE

The moniker class does not have an inverse.

Remarks

The inverse of a moniker is analogous to the ".." directory in MS-DOS file systems; the ".." directory acts as the inverse to any other directory name, because appending ".." to a directory name results in an empty path.

In the same way, the inverse of a moniker typically is also the inverse of all monikers in the same class. However, it is not necessarily the inverse of a moniker of a different class.

The inverse of a composite moniker is a composite consisting of the inverses of the components of the original moniker, arranged in reverse order. For example, if the inverse of A is Inv( A ) and the composite of A, B, and C is Comp( A, B, C ), then

Copy Code
Inv( Comp( A, B, C ) ) 
	is equal to
Comp( Inv( C ), Inv( B ), Inv( A ) ).

Not all monikers have inverses. Most monikers that are themselves inverses, such as anti-monikers, do not have inverses. Monikers that have no inverse cannot have relative monikers formed from inside the objects they identify to other objects outside.

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

Notes to Callers

An object that is using a moniker to locate another object usually does not know the class of the moniker it is using. To get the inverse of a moniker, you should always call IMoniker::Inverserather than the CreateAntiMonikerfunction, because you cannot be certain that the moniker you are using considers an anti-moniker to be its inverse.

The IMoniker::Inversemethod is also called by the implementation of the IMoniker::RelativePathTomethod, to assist in constructing a relative moniker.

Notes to Implementers

If your monikers have no internal structure, you can call the CreateAntiMonikerfunction in to get an anti-moniker in your implementation of IMoniker::Inverse.

In your implementation of the IMoniker::ComposeWithmethod, you need to check for the inverse you supply in the implementation of IMoniker::Inverse.

Requirements

Header objidl.h, objidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also