Partager via


Marshaling Support

A Component Object Model (COM) interface can be marshaled using standard marshaling or custom marshaling. In standard marshaling, proxy and stub code marshals and unmarshals the parameters and return values of an interface method call between processes. The Microsoft Interface Definition Language (MIDL) compiler can be used to generate proxy and stub codes for standard marshaling a COM interface.

In custom marshaling, the object implements the IMarshal interface to marshal the entire object to another process space. For more information about custom marshaling, see the COM specification in the Microsoft MSDN® Library under Specifications and Chapter 6 of Kraig Brockschmidt's Inside OLE, Second Edition in the MSDN Library under Books.

Windows CE provides an implementation of IDispatchProxy when the DCOM component is included. For applications, IDispatchProxy automatically and transparently marshals variants across interfaces. The marshaler provided by Windows CE provides only one level of redirection, that is, references to references of variants are not allowed. Support for IDispatchProxy allows applications written in Visual Basic on the desktop to call remote COM servers running on a Windows CE device.

A sample that demonstrates an application using IDispatchProxy is provided in Platform Builder. You can find the sample in %_WINCEROOT%\Public\Dcom\Sdk\Samples\Idispproxy directory and the readme.txt file that provides instructions for using the sample in the same directory.

IDispatchProxy is not the same as Automation marshaler. Automation marshaler is also known as type library marshaler or universal marshaler. This marshaler allows marshaling based on an interface's type library, which means the interface does not need to have a proxy and a stub. Windows CE does not support Automation marshaler. Interfaces in Windows CE require a proxy and a stub for marshaling.

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.