Help and Support
 

powered byLive Search

An automation server cannot pass a pointer to the picture object's IPictureDisp implementation across process boundaries

Article ID:150034
Last Review:November 21, 2006
Revision:3.1
This article was previously published under Q150034

SYMPTOMS

An 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.

Back to the top

CAUSE

IPictureDisp 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.

Back to the top

STATUS

This behavior is by design.

Back to the top

MORE INFORMATION

The 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.

Back to the top

REFERENCES

For more information on marshaling, please see "Inside OLE," second edition, by Kraig Brockschmidt, Chapter 6, "Local/Remote Transparency," published by Microsoft Press.

Back to the top


APPLIES TO
Microsoft Foundation Class Library 4.2, when used with:
  Microsoft Visual C++ 4.0 Standard Edition
  Microsoft Visual C++ 4.1 Subscription
  Microsoft Visual C++ 4.2 Enterprise Edition
  Microsoft Visual C++ 4.2 Professional Edition
  Microsoft Visual C++ 5.0 Enterprise Edition
  Microsoft Visual C++ 5.0 Professional Edition
  Microsoft Visual C++ 6.0 Enterprise Edition
  Microsoft Visual C++ 6.0 Professional Edition
  Microsoft Visual C++, 32-bit Learning Edition 6.0
  Microsoft OLE Control Developer's Kit (CDK)

Back to the top

Keywords: 
kbtshoot kbbitmap kbautomation kbprb kbctrl KB150034

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.