GetObjectContext routine

Description

Retrieves the object context interface that is associated with your component instance.

Syntax

#include <jagctx.h>

HRESULT GetObjectContext (
            IObjectContext ** ppInstCtx
);

Parameters

ppInstCtx

The address of an IObjectContext interface pointer.

Returns

Return value

To indicate

S_OK

Successful retrieval of the IObjectContext interface pointer.

E_INVALIDARG

ppInstCtx was NULL.

CONTEXT_E_NOCONTEXT

GetObjectContext was called from code that was not executing as part of a component method invocation. This can happen if you run your code outside of EAServer or if you call GetObjectContext from the component’s constructor.

Usage

Call GetObjectContext to obtain an IObjectContext interface pointer.

GetObjectContext is defined in mtx.h; to call it, you must link mtx.lib with your component.

The IObjectContext interface is not available unless GetObjectContext is called from code that is executing in the context of a component method invocation.

The IObjectContext interface is not available in the component’s class constructor.

An IObjectContext reference is not valid after an instance has been deactivated. If your component implements the IObjectControl interface, you can obtain an IObjectContext pointer in the Activate method and release it when Deactivate is called. Components that do not implement IObjectControl can obtain an IObjectContext pointer and release it in the destructor.

See also

IObjectContext interface