Image Class OLE Type Mismatch

I’m using the VFP (Visual FoxPro) code below to create an instance of the MapWinGIS IMAGE class so that the resulting IMAGE object can be used for a Shape object. The image object is created however, my call to the loImg.Open() method creates an OLE Error “Code 0x80020005 Type Mismatch”.

* Create a MapWinGIS image object based on local image file
#DEFINE ImageType_Bitmap_File                   0
#DEFINE ImageType_Use_File_Extension            2
#DEFINE ImageType_JPEG_File                     4

loImg     = CreateObject("MapWinGIS.Image")
loImg.Open("s:\mapwingis\car.jpg", ImageType_JPEG_File )

I’ve confirmed that the file exists in the specified path and that the file is in fact a jpg file type.
I’ve also tried using a Bitmap image with ImageType_Bitmap_File and ImageType_Use_File_Extension

Any thoughts on what might be the source of a type mismatch error when I call the Open() method?

FWIW - Another VFP developer on a different machine is seeing the same error.

In my debugger I see a lot of properties inside the Image object. In VFP I can use a FileToStr() function to read the binary contents of the file into a memory variable. Is there a way to stuff the binary value of the jpg image into the object instead of using the Open() method?


By using the VFP CreateObjectEX() function instead of the CreateObject() function, the control generated a new error “Must supply additional parameters”. Once all 4 parameters are specified (even though 3 of the 4 parameters are considered optional) the .OPEN() method successfully created the IMAGE class object and opened the image file.

loImg     = CreateObjectEX("MapWinGIS.Image","","")
loImg.Open( 's:\mapwingis\car.jpg', ImageType_JPEG_File, .F., .null.)

*** It might still be handy to know if there is a property in an IMAGE class object, where the binary string representation of the image can be set or directly inserted ?**