IMoniker::Inverse

Returns a moniker that, when composed to the right of this moniker or one of similar structure, will destroy it (that is, will compose to nothing).

HRESULT Inverse(

IMoniker **ppmk
//Receives the inverse of the moniker
);

Parameter

ppmk

[out] Receives a pointer to the inverse moniker. If an error occurs, the implementation sets *ppmk to NULL. If *ppmk is non-NULL, the implementation must call IUnknown::AddRef on the parameter; it is the caller's responsibility to call IUnknown::Release.

Return Values

S_OK

The inverse moniker has been returned successfully.

MK_E_NOINVERSE

Indicates that the moniker class does not have an inverse.

E_OUTOFMEMORY

Indicates insufficient memory.

Comments

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

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 do not have inverses; for example, 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.

Notes to Callers

If you're a moniker client, you typically do not know the class of the moniker you're using. If you need to get the inverse of a moniker, you should always call IMoniker::Inverse rather than the CreateAntiMoniker API function, because you cannot be certain that the moniker you're using considers an anti-moniker to be its inverse.

The IMoniker::Inverse method is also called by the implementation of the IMoniker::RelativePathTo method, to assist in constructing a relative moniker.

Notes to Implementors

If your monikers have no internal structure, your implementation of IMoniker::Inverse can return an anti-moniker using the CreateAntiMoniker API function. Whatever you return from IMoniker::Inverse is what you must check for in your implementation of IMoniker::ComposeWith.

See Also

CreateAntiMoniker, IMoniker::ComposeWith, IMoniker::RelativePathTo

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples