【问题标题】:StrPtr type mismatch in 64 bit mode64 位模式下的 StrPtr 类型不匹配
【发布时间】:2016-02-25 03:49:45
【问题描述】:

我在 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,编译器就OK了。

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 中的类型不匹配。不知道怎么解决。

【问题讨论】:

    标签: vba ms-access 32bit-64bit


    【解决方案1】:

    将 LongPtr 用于 64 位而不是 Long。

    Private Declare PtrSafe Function GdipCreateBitmapFromFile Lib "gdiplus.dll" (ByVal FileName As LongPtr, bitmap As Long) As Long
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-05
      • 2019-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-21
      • 1970-01-01
      相关资源
      最近更新 更多