By Adam Nagy
As mentioned in this blog post as well, for some reason the Handle of the IPictureDisp returned by the Thumbnail property of ApprenticeServerDocument can sometimes be negative.
I tested this with my own app as well – the one referenced in this blog post.
Strangely, when my .NET app is compiled to 32 bit, it seems to cause no issue for the AxHostConverter.PictureDispToImage() converter method (see below) to turn the IPictureDisp into a System.Drawing.Image:
internal class AxHostConverter : AxHost { private AxHostConverter() : base("") { } static public stdole.IPictureDisp ImageToPictureDisp(Image image) { return (stdole.IPictureDisp)GetIPictureDispFromPicture(image); } static public Image PictureDispToImage(stdole.IPictureDisp pictureDisp) { return GetPictureFromIPicture(pictureDisp); } }

Leave a Reply