Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
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 CoSwitchCallContextis called with another object.

It may be NULL if your application is calling CoSwitchCallContextto 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 CoSwitchCallContextto 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 CoSwitchCallContextagain, 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