Chapter 2 ActiveX C++ Interface Reference


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.

Return Values

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 Jaguar method invocation. This can happen if you run your code outside of the Jaguar server 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 Jaguar 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 don't implement IObjectControl can obtain an IObjectContext pointer and release it in the destructor.

See Also

IObjectContext interface

 


Copyright © 2000 Sybase, Inc. All rights reserved.