【发布时间】: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。