Partager via


IBindCtx::GetObjectParam (Compact 2013)

3/26/2014

This method retrieves the pointer associated with the specified key in the bind context's string-keyed table of pointers.

The IBindCtx::GetObjectParam method is supported in DCOM, but it is not supported in COM.

Calling this method in COM returns a value of E_NOTIMPL.

Syntax

HRESULT GetObjectParam(
  LPOLESTR pszKey,
  IUnknown** ppunk
);

Parameters

  • pszKey
    [in] Pointer to a zero-terminated wide character string (two bytes per character) containing the key to search for. Key string comparison is case-sensitive.
  • ppunk
    [out] Address of the IUnknown* pointer variable that receives the interface pointer to the object associated with pszKey.

    When successful, the implementation calls the IUnknown::AddRef method on *ppunk.

    It is the caller's responsibility to call the IUnknown::Release method.

    If an error occurs, the implementation sets *ppunk to NULL.

Return Value

The following table shows the return values for this method.

Value

Description

E_FAIL

A standard return value.

S_OK

The pointer associated with the specified key was successfully returned.

Remarks

A bind context maintains a table of interface pointers, each associated with a string key. This enables communication between a moniker implementation and the caller that initiated the binding operation.

One party can store an interface pointer under a string known to both parties so that the other party can later retrieve it from the bind context.

The pointer this method retrieves must have previously been inserted into the table using the IBindCtx::RegisterObjectParam method.

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

Notes to Callers

Those writing a new moniker class (through an implementation of IMoniker) and some moniker clients (objects using a moniker to bind to an object) can call IBindCtx::GetObjectParam.

Objects using monikers to locate other objects can call this method when a binding operation fails to get specific information about the error that occurred.

Depending on the error, it may be possible to correct the situation and retry the binding operation. See IBindCtx::RegisterObjectParam for more information.

Moniker implementations can call this method to deal with situations where a caller initiates a binding operation and requests specific information.

By convention, the implementer should use key names that begin with the string form of the CLSID of a moniker class. See the StringFromCLSID function.

Requirements

Header

objidl.h,
objidl.idl

Library

ole32.lib,
uuid.lib

See Also

Reference

IBindCtx
StringFromCLSID
IMoniker
IBindCtx::RegisterObjectParam
IBindCtx::EnumObjectParam
IUnknown::AddRef
IUnknown::Release