Expand Minimize

CoGetObjectContext function

Returns the context for the current object.

Syntax


HRESULT CoGetObjectContext(
  _In_   REFIID riid,
  _Out_  LPVOID *ppv
);

Parameters

riid [in]

A reference to the ID of an interface that is implemented on the context object.

For objects running within COM applications, IID_IComThreadingInfo, IID_IContext, and IID_IContextCallback are available.

For objects running within COM+ applications, IID_IObjectContext, IID_IObjectContextActivity IID_IObjectContextInfo, and IID_IContextState are available.

ppv [out]

The address of a pointer to the interface specified by riid on the context object.

Return value

This function can return the standard return values E_OUTOFMEMORY and E_UNEXPECTED, as well as the following values.

Return codeDescription
S_OK

The object context was successfully retrieved.

E_NOINTERFACE

The requested interface was not available.

CO_E_NOTINITIALIZED

Before this function can be called, the CoInitializeEx function must be called on the current thread.

 

Remarks

CoGetObjectContext retrieves the context for the object from which it is called, and returns a pointer to an interface that can be used to manipulate context properties. Context properties are used to provide services to configured components running within COM+ applications.

For components running within COM applications, the following interfaces are supported for accessing context properties: IComThreadingInfo, IContext, and IContextCallback.

For components running within COM+ applications, the following interfaces are supported for accessing context properties: IObjectContext, IObjectContextActivity, IObjectContextInfo, and IContextState.

Windows Phone 8: This API is supported.

Windows Phone 8.1: This API is supported.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

Objbase.h

Library

Ole32.lib

DLL

Ole32.dll

See also

Contexts and Threading Models

 

 

Community Additions

ADD
Show:
© 2014 Microsoft