IContextCallback::ContextCallback method (ctxtcall.h)

Enters the object context, executes the specified function, and returns.

Syntax

HRESULT ContextCallback(
  [in] PFNCONTEXTCALL pfnCallback,
  [in] ComCallData    *pParam,
  [in] REFIID         riid,
  [in] int            iMethod,
  [in] IUnknown       *pUnk
);

Parameters

[in] pfnCallback

The function to be called inside the object context.

[in] pParam

The data to be passed to the function when it is called in the context.

[in] riid

The IID of the call that is being simulated. See Remarks for more information.

[in] iMethod

The method number of the call that is being simulated. See Remarks for more information.

[in] pUnk

This parameter is reserved and must be NULL.

Return value

This method can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL. If none of these failures occur, the return value of this function is the HRESULT value returned by the pfnCallback function.

Remarks

This method simulates a method call on an object inside the context. It is intended for low-level operations, such as cleanup/lazy marshaling, that respect the application's reentrancy expectations.

To give the infrastructure information, an interface and method number must be specified. The parameter riid must not be IID_IUnknown, and the method number must not be less than 3.

If riid is set to IID_IEnterActivityWithNoLock, the function is executed without an activity lock.

If riid is set to IID_ICallbackWithNoReentrancyToApplicationSTA, the function does not reenter an ASTA arbitrarily. Most apps should set riid to this values for general purpose use.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header ctxtcall.h

See also

IContextCallback