Skip to content

Latest commit

 

History

History
85 lines (68 loc) · 4.12 KB

nf-objbase-createantimoniker.md

File metadata and controls

85 lines (68 loc) · 4.12 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name req.apiset
NF:objbase.CreateAntiMoniker
CreateAntiMoniker function (objbase.h)
Creates and returns a new anti-moniker.
CreateAntiMoniker
CreateAntiMoniker function [COM]
_com_CreateAntiMoniker
com.createantimoniker
objbase/CreateAntiMoniker
com\createantimoniker.htm
com
1f8fcbd6-8f05-4d32-af8a-d8de1b56dacf
12/05/2018
CreateAntiMoniker, CreateAntiMoniker function [COM], _com_CreateAntiMoniker, com.createantimoniker, objbase/CreateAntiMoniker
objbase.h
Windows
Windows 2000 Professional [desktop apps \| UWP apps]
Windows 2000 Server [desktop apps \| UWP apps]
Ole32.lib
Ole32.dll
Windows
19H1
CreateAntiMoniker
objbase/CreateAntiMoniker
c++
APIRef
kbSyntax
DllExport
Ole32.dll
CreateAntiMoniker
ext-ms-win-com-ole32-l1-1-5 (introduced in Windows 10, version 10.0.15063)

CreateAntiMoniker function

-description

Creates and returns a new anti-moniker.

-parameters

-param ppmk [out]

The address of an IMoniker* pointer variable that receives the interface pointer to the new anti-moniker. When successful, the function has called AddRef on the anti-moniker and the caller is responsible for calling Release. When an error occurs, the anti-moniker pointer is NULL.

-returns

This function can return the standard return values E_OUTOFMEMORY and S_OK.

-remarks

You would call this function only if you are writing your own moniker class (implementing the IMoniker interface). If you are writing a new moniker class that has no internal structure, you can use CreateAntiMoniker in your implementation of the IMoniker::Inverse method, and then check for an anti-moniker in your implementation of IMoniker::ComposeWith.

Like the ".." directory, 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, you would call IMoniker::Inverse rather than CreateAntiMoniker.

To remove the last piece of a composite moniker, you would do the following:

  1. Call IMoniker::Enum on 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::Inverse on that moniker. The moniker returned by Inverse will remove the last piece of the composite.

-see-also

IMoniker