다음을 통해 공유


IMTxAS::GetObjectContext method

Retrieves the context that is associated with the current COM+ object.

In C++, the GetObjectContext function should be used instead of this method.

Syntax

HRESULT GetObjectContext(
  [out, retval] ObjectContext **ppContext
);

Parameters

  • ppContext [out, retval]
    A reference to ObjectContext on the object's context.

Return value

This method can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following values.

Return code Description
S_OK

The method completed successfully.

CONTEXT_E_NOCONTEXT

The current object does not have a context associated with it because either the component was not imported into an application or the object was not created with one of the COM+ CreateInstance methods. This error is also returned if the GetObjectContext method was called from a constructor or from an IUnknown method.

 

Remarks

An object's context is not accessible from an object's constructor or from any IUnknown method.

An object should never attempt to pass its ObjectContext reference to another object. If you pass an ObjectContext reference to another object, it is no longer a valid reference.

When an object obtains a reference to its context object, it must release the ObjectContext object when it is finished with it.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

See also

COM+ Contexts and Threading Models

GetObjectContext

IMTxAS