Skip to content

Latest commit

 

History

History
107 lines (75 loc) · 5.51 KB

nf-objbase-createitemmoniker.md

File metadata and controls

107 lines (75 loc) · 5.51 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.CreateItemMoniker
CreateItemMoniker function (objbase.h)
Creates an item moniker that identifies an object within a containing object (typically a compound document).
CreateItemMoniker
CreateItemMoniker function [COM]
_com_CreateItemMoniker
com.createitemmoniker
objbase/CreateItemMoniker
com\createitemmoniker.htm
com
339919ed-660c-4239-825b-7fa96c48e5cd
12/05/2018
CreateItemMoniker, CreateItemMoniker function [COM], _com_CreateItemMoniker, com.createitemmoniker, objbase/CreateItemMoniker
objbase.h
Windows
Windows 2000 Professional [desktop apps \| UWP apps]
Windows 2000 Server [desktop apps \| UWP apps]
Ole32.lib
Ole32.dll
Windows
19H1
CreateItemMoniker
objbase/CreateItemMoniker
c++
APIRef
kbSyntax
DllExport
Ole32.dll
Ext-MS-Win-COM-OLE32-l1-1-0.dll
Ext-MS-Win-COM-OLE32-l1-1-1.dll
Ext-MS-Win-COM-OLE32-l1-1-2.dll
ext-ms-win-com-ole32-l1-1-3.dll
Ext-MS-Win-Com-Ole32-L1-1-4.dll
CreateItemMoniker
ext-ms-win-com-ole32-l1-1-0 (introduced in Windows 8)

CreateItemMoniker function

-description

Creates an item moniker that identifies an object within a containing object (typically a compound document).

-parameters

-param lpszDelim [in]

A pointer to a wide character string (two bytes per character) zero-terminated string containing the delimiter (typically "!") used to separate this item's display name from the display name of its containing object.

-param lpszItem [in]

A pointer to a zero-terminated string indicating the containing object's name for the object being identified. This name can later be used to retrieve a pointer to the object in a call to IOleItemContainer::GetObject.

-param ppmk [out]

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

-returns

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

-remarks

A moniker provider, which hands out monikers to identify its objects so they are accessible to other parties, would call CreateItemMoniker to identify its objects with item monikers. Item monikers are based on a string, and identify objects that are contained within another object and can be individually identified using a string. The containing object must also implement the IOleContainer interface.

Most moniker providers are OLE applications that support linking. Applications that support linking to objects smaller than file-based documents, such as a server application that allows linking to a selection within a document, should use item monikers to identify the objects. Container applications that allow linking to embedded objects use item monikers to identify the embedded objects.

The lpszItem parameter is the name used by the document to uniquely identify the object. For example, if the object being identified is a cell range in a spreadsheet, an appropriate name might be something like "A1:E7." An appropriate name when the object being identified is an embedded object might be something like "embedobj1." The containing object must provide an implementation of the IOleItemContainer interface that can interpret this name and locate the corresponding object. This allows the item moniker to be bound to the object it identifies.

Item monikers are not used in isolation. They must be composed with a moniker that identifies the containing object as well. For example, if the object being identified is a cell range contained in a file-based document, the item moniker identifying that object must be composed with the file moniker identifying that document, resulting in a composite moniker that is the equivalent of "C:\work\sales.xls!A1:E7."

Nested containers are allowed also, as in the case where an object is contained within an embedded object inside another document. The complete moniker of such an object would be the equivalent of "C:\work\report.doc!embedobj1!A1:E7." In this case, each containing object must call CreateItemMoniker and provide its own implementation of the IOleItemContainer interface.

-see-also

IMoniker

IMoniker::ComposeWith

IOleContainer

IOleItemContainer