我在Access 2013中使用了以下代码(从网站获取)。它没有任何问题。
Private Declare Function GdipCreateBitmapFromFile Lib "gdiplus.dll" (ByVal FileName As Long, bitmap As Long) As Long
If GdipCreateBitmapFromFile(StrPtr(sFileName), hPic) = 0 Then ....
在为Access 2013 64位运行时安装删除32位组件后,我收到编译器错误。我在Declare之后添加了PtrSafe,编译器就可以了。
Private Declare PtrSafe Function GdipCreateBitmapFromFile Lib "gdiplus.dll" (ByVal FileName As Long, bitmap As Long) As Long
If GdipCreateBitmapFromFile(StrPtr(sFileName), hPic) = 0 Then ....
但是,它会有运行时错误 - StrPtr中的类型不匹配。不知道如何解决它。
答案 0 :(得分:3)
将LongPtr用于64位而不是Long。
Private Declare PtrSafe Function GdipCreateBitmapFromFile Lib "gdiplus.dll" (ByVal FileName As LongPtr, bitmap As Long) As Long