OleCreatePictureIndirect() WinAPI call problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I got problems with the WinAPI call OleCreatePictureIndirect() in C#.

Has anybody ever used this function call in C#?

Thanks,

Minfu
 
The purpose of using this function is to copy the image of a form to the
system clipboard.
 
This problem is the fouth Out paramter IPicture. I defined a
System.Drawing.Iamge variable and passed it as Out. An unhandled exception
occurs every time when I call this function. I searched
http://www.pinvoke.net, but there is NO any info for this API.
 
Minfu,

Just curious, why do you want to call this API? You can take the handle
of an Icon, or bitmap, and pass it to the static FromHbitmap method on the
Image class, or to the static FromHandle method on the Icon class.

Or is there another reason you want to use this API?
 
Minfu Lu said:
This problem is the fouth Out paramter IPicture. I defined a
System.Drawing.Iamge variable and passed it as Out. An unhandled exception
occurs every time when I call this function. I searched
http://www.pinvoke.net, but there is NO any info for this API.
"Out" means that the callee returns a value, you should not pass anything
but an IntPtr, the received value is an Interface pointer for the COM
Interface requested (in second arg.), this interface can be used to access
the COM IPicture object that corresponds to the bitmap passed as first
argument.
But, I have to ask why you need to call this function, you are trying to
mix System.Drawing.Image (GDI+ ) with COM based (OLE) GDI access, this is
something you try to avoid by all means.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top