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 code | Description |
|---|---|
|
The object context was successfully retrieved. |
|
The requested interface was not available. |
|
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.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps | Windows Store apps] |
|
Minimum supported phone |
Windows Phone 8 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also