Skip to content

Latest commit

 

History

History
130 lines (99 loc) · 4.81 KB

nf-objbase-bindmoniker.md

File metadata and controls

130 lines (99 loc) · 4.81 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.BindMoniker
BindMoniker function (objbase.h)
Locates an object by means of its moniker, activates the object if it is inactive, and retrieves a pointer to the specified interface on that object.
BindMoniker
BindMoniker function [COM]
_com_BindMoniker
com.bindmoniker
objbase/BindMoniker
com\bindmoniker.htm
com
5a022c39-fc2c-458b-9dfe-fed1255d49a4
12/05/2018
BindMoniker, BindMoniker function [COM], _com_BindMoniker, com.bindmoniker, objbase/BindMoniker
objbase.h
Windows
Windows 2000 Professional [desktop apps \| UWP apps]
Windows 2000 Server [desktop apps \| UWP apps]
Ole32.lib
Ole32.dll
Windows
19H1
BindMoniker
objbase/BindMoniker
c++
APIRef
kbSyntax
DllExport
Ole32.dll
BindMoniker
ext-ms-win-com-ole32-l1-1-5 (introduced in Windows 10, version 10.0.15063)

BindMoniker function

-description

Locates an object by means of its moniker, activates the object if it is inactive, and retrieves a pointer to the specified interface on that object.

-parameters

-param pmk [in]

A pointer to the object's moniker. See IMoniker.

-param grfOpt [in]

This parameter is reserved for future use and must be 0.

-param iidResult [in]

The interface identifier to be used to communicate with the object.

-param ppvResult [out]

The address of pointer variable that receives the interface pointer requested in iidResult. Upon successful return, *ppvResult contains the requested interface pointer. If an error occurs, *ppvResult is NULL. If the call is successful, the caller is responsible for releasing the pointer with a call to the object's IUnknown::Release method.

-returns

This function can return the following error codes, or any of the error values returned by the IMoniker::BindToObject method.

Return code Description
S_OK
The object was located and activated, if necessary, and a pointer to the requested interface was returned.
MK_E_NOOBJECT
The object that the moniker object identified could not be found.

-remarks

BindMoniker is a helper function supplied as a convenient way for a client that has the moniker of an object to obtain a pointer to one of that object's interfaces. BindMoniker packages the following calls:

CreateBindCtx(0, &pbc); 
pmk->BindToObject(pbc, NULL, riid, ppvObj);

CreateBindCtx creates a bind context object that supports the system implementation of IBindContext. The pmk parameter is actually a pointer to the IMoniker implementation on a moniker object. This implementation's BindToObject method supplies the pointer to the requested interface pointer.

If you have several monikers to bind in quick succession and if you know that those monikers will activate the same object, it may be more efficient to call the IMoniker::BindToObject method directly, which enables you to use the same bind context object for all the monikers. See the IBindCtx interface for more information.

Container applications that allow their documents to contain linked objects are a special client that generally does not make direct calls to IMoniker methods. Instead, the client manipulates the linked objects through the IOleLink interface. The default handler implements this interface and calls the appropriate IMoniker methods as needed.

-see-also

CreateBindCtx

IMoniker::BindToObject