I am using GDI+ to load a JPG image and convert it to a bitmap handle I can use in my program. It works perfectly on every computer I have tried it with, but one of my users is receiving an error. Here is a stripped down copy of the code I am using:
Any ideas why she is getting Error 7 for the GdipCreateHBITMAPFromBitmap call? I think she is using Windows Vista Ultimate, but am waiting for her to confirm.
Thanks,
Anthony
Code:
LOCAL bm AS BITMAP LOCAL hr AS LONG LOCAL strFileName AS STRING LOCAL pBitmap AS DWORD LOCAL hBitmap AS DWORD LOCAL token AS DWORD LOCAL nStatus AS LONG LOCAL StartupInput AS GdiplusStartupInput LOCAL nRect AS RECTL LOCAL bmpData AS BitmapData LOCAL origwidth AS SINGLE LOCAL origheight AS SINGLE '** Start GDI+ - Returns 0: Success StartupInput.GdiplusVersion = 1 nStatus = GdiplusStartup(token, StartupInput, BYVAL 0) '** Load the JPG image file - Returns 0: Success strFilename = UCODE$(f$) hr = GdipCreateBitmapFromFile (strFileName, pBitmap) '** Obtain image dimensions - Returns proper dimensions l=GdipGetImageDimension (BYVAL pBitmap, BYREF origwidth, BYREF origheight) '** Get a bitmap handle for the object - Returns error 7: Win32Error '** Works fine on every machine I have, but customer machine returns error hr2=GdipCreateHBITMAPFromBitmap(pBitmap,hBitmap,0)
Thanks,
Anthony
Comment