PRB: LPPICTUREDISP Cannot Be Passed Across Process BoundariesLast reviewed: February 17, 1998Article ID: Q150034 |
The information in this article applies to:
SYMPTOMSAn automation server that implements a Picture object wrapped by the CPictureHolder class in MFC fails when it attempts to pass a pointer to the picture object's IPictureDisp implementation across process boundaries.
CAUSEIPictureDisp gains access to methods of the Picture object that cannot be marshaled across process boundaries. For example, IPictureDisp supports DISPID_PICT_RENDER to gain access to the Render method of the Picture object. The Render method takes a handle to a device context as the first parameter. Device context handles cannot be marshaled. Dispatch interfaces can normally be marshalled by using the IDispatch marshaling code, but the Picture object implements IMarshal specifically to cause its marshaling to fail.
STATUSThis behavior is by design.
MORE INFORMATIONThe ClassWizard in Visual C++ allows you to select a return type of LPPICTUREDISP for a method. This method might return the IPictureDisp interface obtained by calling CPictureHolder::GetPictureDispatch. However, if this method is called by a controller running in another process, the method fails and returns an error code of E_FAIL. Because the Picture object causes the marshaling of IPictureDisp to fail, problems can also occur when trying to obtain an IPictureDisp interface across thread boundaries in a multiple-thread apartment model object.
REFERENCESFor more information on marshaling, please see "Inside OLE," second edition, by Kraig Brockschmidt, Chapter 6, "Local/Remote Transparency," published by Microsoft Press. Keywords : CDKIss MfcOLE Technology : kbole kbMfc Version : Winnet:1.5,1.51,1.52,2.0,2.1,2.2,5.0 Platform : WINDOWS Issue type : kbprb |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |