睡眠库"kernel32"给出64位系统错误 [英] Sleep Lib "kernel32" gives 64-bit systems error

查看:150
本文介绍了睡眠库"kernel32"给出64位系统错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行所有功能后关闭访问权限(Application.Quit).

I'm trying to close access (Application.Quit) after running all functions.

所有功能完成后的VBA关闭访问为我.

但是当我Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)时,出现以下错误:

but when I Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long), It's giving me the following error:

该项目中的代码必须进行更新才能在64位系统上使用.

The code in this project must be updated for use on 64 bit systems.

在完全关闭访问权限之前,是否可以替换此代码来运行所有功能?

Is there any replacement of this code to do run all functions before completely closing access?

推荐答案

dwMilliseconds参数是DWORD,因此从技术上讲,它将在32位计算机上为32位,在64位计算机上为64位.因此,它需要PtrSafe表示法(尽管从技术上讲dwMilliseconds会正确地编组,因为它是ByVal ...而且无论如何都要等待那么长时间)将声明更改为:

The dwMilliseconds parameter is a DWORD, so it will technically be 32bit on a 32bit machine and 64bit on a 64bit machine. Because of this, it requires PtrSafe notation (although technically dwMilliseconds will marshal correctly because it's ByVal... and who wants to wait that long anyway) Change the declaration to this:

#If VBA7 Then
    Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)
#Else
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If

这篇关于睡眠库"kernel32"给出64位系统错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆