Hi Christian,
> Just want to throw in that this is buggy ..
>
> #define CF_DIB 8
> if oDataObject.GetFormat( 2 )
> lcData = oDataObject.GetData( CF_DIB )
> strtofile( lcData, "myimage.dib" )
> this.picture = "myimage.dib"
> endif
>
Unfortunately you can't use the raw DIB (BITMAPINFO) structure that GetData( CF_DIB ) returns like your snippet illustrates.
Fortunately Herman Tan just posted code that parses the raw DIB info returned by GetData() and adds the header necessary to convert the DIB content into a fully formed BMP file.
Unfortunately (do I sound like a soap opera? hope that translates) Office apps appear to convert their images to a 256 color palette when filling the oDataObject with DIB data.
There may be other image formats present when GetFormat( CF_BITMAP ) is True (metafile and enhanced metafile formats?) I'm going to see how Office transfers data in these formats - hopefully without loss of color resolution!
> only because the Dataobject contains data of type CF_BITMAP doesn't neccessarily mean that there's also data of type CF_DIB .. Word puts images in both formats into the dataobject .. but that doesn't have to be true for other applications .., it's up to the application you're dragging from if there is CF_DIB data, CF_BITMAP or both.
Excellent point. I will add error handling code to my solution to make sure that the expected information is present.
Thanks for your suggestions!
Malcolm