Share via


CoSwitchCallContext

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function switches the call context object used by CoGetCallContext.

Syntax

HRESULT CoSwitchCallContext(
  IUnknown* pNewObject,
  IUnknown** ppOldObject
);

Parameters

  • pNewObject
    [in] A pointer to an interface on the new call context object.

    COM will keep a reference to the pointer until CoSwitchCallContext is called with another object.

    It may be NULL if your application is calling CoSwitchCallContext to switch back to the original call context and there was no original call context.

  • ppOldObject
    [out] Address of pointer variable that receives a pointer to the call context object of the call currently in progress.

    This value is returned so that the original call context can be restored by the custom marshaler.

    The returned pointer will be NULL if there was no call in progress.

Return Value

  • S_OK
    Success.
  • E_OUT_OF_MEMORY
    There is insufficient memory to complete this operation.

Remarks

Custom marshalers call CoSwitchCallContext to change the call context object used by CoGetCallContext.

Before dispatching an arriving call, custom marshalers call CoSwitchCallContext, specifying the new context object.

After sending a reply, they must restore the original call context by calling CoSwitchCallContext again, this time passing a pointer to the original context object.

Call context objects provided by custom marshalers should support IServerSecurity.

To determine whether the platform supports this function, see Determining Supported COM APIs.

Requirements

Header objbase.h
Library ole32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

COM Functions