【问题标题】:adding PtrSafe to vba function call into 3rd party dll causes error in 64-bit Excel将 PtrSafe 添加到 vba 函数调用到第 3 方 dll 会导致 64 位 Excel 中的错误
【发布时间】:2019-02-22 19:40:44
【问题描述】:

我有一个 VBA 项目,它对第 3 方 dll 进行 3 次调用,如下所示:

Private Declare Function cm_checkprotection Lib "ACPPYRAMID.DLL" Alias "CM_CheckProtection" (ByVal options As Long) As Long
Private Declare Function cm_getextendederror Lib "ACPPYRAMID.DLL" Alias "CM_GetExtendedError" (ByVal ExtErr As Any) As Long
Private Declare Function cm_getproductkeya Lib "ACPPYRAMID.DLL" Alias "CM_GetProductKeyA" (ByVal ProductKey As Any) As Long

我正在尝试将此项目移植到 64 位 Excel 中,但是当我在声明中添加“PtrSafe”时,Excel 会出现“预期:表达式”错误,如附图所示。

知道如何解决这个问题吗?

TIA,

弗兰克

【问题讨论】:

  • 如果您在 Google 中输入 PtrSafe Declare,您就会得到答案...
  • 或者,如果您在代码中查看了几行,您就会得到答案...Private Declare PtrSafe Function Shellexecute... ;)
  • @SiddharthRout - 即使只是搜索VBA PtrSafe 也会返回MS Page 作为第一个结果。
  • 回答你的下一个问题,也是LongPtr,而不是PtrLong

标签: excel vba 64-bit


【解决方案1】:

将位置移到

Private Declare PtrSafe Function 

【讨论】:

    猜你喜欢
    • 2015-09-17
    • 1970-01-01
    • 2020-09-21
    • 2019-06-27
    • 2016-08-11
    • 1970-01-01
    • 1970-01-01
    • 2018-11-02
    • 2021-07-29
    相关资源
    最近更新 更多