Well, I was thinking that sometimes you can't be sure what version someone is running, so you might need to have different definitions
The fragment was old, so it might be OBE
'Declare a UDT to store a GUID for the IPicture OLE Interface Private Type GUID Data1 As Long Data2 As Integer Data3 As Integer Data4(0 To 7) As Byte End Type #If VBA7 Then 'Declare a UDT to store the bitmap information Private Type PICTDESC Size As Long Type As Long hPic As LongPtr hPal As LongPtr End Type 'Declare a UDT to store the GDI+ Startup information Private Type GdiplusStartupInput GdiplusVersion As Long DebugEventCallback As LongPtr SuppressBackgroundThread As Long SuppressExternalCodecs As Long End Type 'Windows API calls into the GDI+ library Private Declare PtrSafe Function GdiplusStartup Lib "GDIPlus" (token As LongPtr, inputbuf As GdiplusStartupInput, Optional ByVal outputbuf As LongPtr = 0) As Long Private Declare PtrSafe Function GdipCreateBitmapFromFile Lib "GDIPlus" (ByVal fileName As LongPtr, bitmap As LongPtr) As Long Private Declare PtrSafe Function GdipCreateHBITMAPFromBitmap Lib "GDIPlus" (ByVal bitmap As LongPtr, hbmReturn As LongPtr, ByVal background As LongPtr) As Long Private Declare PtrSafe Function GdipDisposeImage Lib "GDIPlus" (ByVal image As LongPtr) As Long Private Declare PtrSafe Sub GdiplusShutdown Lib "GDIPlus" (ByVal token As LongPtr) Private Declare PtrSafe Function OleCreatePictureIndirect Lib "oleaut32" (PicDesc As PICTDESC, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long #Else 'Declare a UDT to store the bitmap information Private Type PICTDESC Size As Long Type As Long hPic As Long hPal As Long End Type 'Declare a UDT to store the GDI+ Startup information Private Type GdiplusStartupInput GdiplusVersion As Long DebugEventCallback As Long SuppressBackgroundThread As Long SuppressExternalCodecs As Long End Type 'Windows API calls into the GDI+ library Private Declare Function GdiplusStartup Lib "GDIPlus" (token As Long, inputbuf As GdiplusStartupInput, Optional ByVal outputbuf As Long = 0) As Long Private Declare Function GdipCreateBitmapFromFile Lib "GDIPlus" (ByVal fileName As Long, bitmap As Long) As Long Private Declare Function GdipCreateHBITMAPFromBitmap Lib "GDIPlus" (ByVal bitmap As Long, hbmReturn As Long, ByVal background As Long) As Long Private Declare Function GdipDisposeImage Lib "GDIPlus" (ByVal image As Long) As Long Private Declare Sub GdiplusShutdown Lib "GDIPlus" (ByVal token As Long) Private Declare Function OleCreatePictureIndirect Lib "oleaut32" (PicDesc As PICTDESC, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long #End If




Reply With Quote