IBindCtx

The IBindCtx interface provides access to a bind context, which is an object that stores information about a particular moniker binding operation. You pass a bind context as a parameter when calling many methods of IMoniker and in certain functions related to monikers.

A bind context includes the following information:

When to Implement

You do not need to implement this interface. The system provides an IBindCtx implementation, accessible though a call to the CreateBindCtx function, that is suitable for all situations.

When to Use

Anyone writing a new moniker class by implementing the IMoniker interface must call IBindCtx methods in the implementation of several IMoniker methods. Moniker providers (servers that hand out monikers to identify their objects) may also need to call IBindCtx methods from their implementations of the IOleItemContainer or IParseDisplayName interfaces.

Moniker clients (objects that use monikers to acquire interface pointers to other objects) typically don’t call many IBindCtx methods. Instead, they simply pass a bind context as a parameter in a call to an IMoniker method. To acquire an interface pointer and activate the indicated object (called binding to an object), moniker clients typically do the following:

  1. Call the CreateBindCtx function to create a bind context and get a pointer to the IBindCtx interface on the bind context object..

  2. If desired (although this is rarely necessary), the moniker client can call IBindCtx::SetBindOptions to specify the bind options.

  3. Pass the bind context as a parameter to the desired IMoniker method (usually IMoniker::BindToObject).

  4. Call IUnknown::Release on the bind context to release it.

Although applications that act as link containers (container applications that allow their documents to contain linked objects) are moniker clients, they rarely call IMoniker methods directly. Generally, they manipulate linked objects through the system implementation (in the default handler) of the IOleLink interface. This implementation calls the appropriate IMoniker methods as needed, and, in doing so, passes pointers to IBindCtx interfaces on the proper bind context objects.

Methods in Vtable Order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments the reference count.

Release

Decrements the reference count.

IBindCtx Methods

Description

RegisterObjectBound

Registers an object with the bind context.

RevokeObjectBound

Revokes an object’s registration.

ReleaseBoundObjects

Releases all registered objects.

SetBindOptions

Sets the binding options.

GetBindOptions

Retrieves the binding options.

GetRunningObjectTable

Retrieves a pointer to the Running Object Table.

RegisterObjectParam

Associates an object with a string key.

GetObjectParam

Returns the object associated with a given string key.

EnumObjectParam

Enumerates all the string keys in the table.

RevokeObjectParam

Revokes association between an object and a string key.

See Also

CreateBindCtx, IMoniker, IOleItemContainer, IParseDisplayName