在 VBA 中休眠(整数溢出!!)

发布于 2024-09-03 00:53:29 字数 228 浏览 3 评论 0原文

在 VBA 中,您可以

声明 Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

为自己提供睡眠例程。

但是,对于超过 32000 毫秒的值,必须传递给例程的 Long 似乎会溢出。

有没有一种方法可以让睡眠时间更长,而无需将多次连续调用睡眠例程的复杂性串联在一起?

In VBA you can

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

to provide yourself with a sleep routine.

However, the Long that must be passed to the routine appears to overflow for values in excess of 32000 milliseconds.

Is there a way to sleep for longer periods of time without the complexity of stringing together several consecutive calls to the sleep routine?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仅冇旳回忆 2024-09-10 00:53:29

不,它不会溢出,除非计算所需毫秒数的代码导致溢出。

示例:

dim t as long
t = 10000 * 10000 / 10000 'Overflow

示例 2:

dim t as long
t = 10000! * 10000 / 10000 'Ok

No, it doesn't overflow, unless your code that calculates required number of milliseconds causes an overflow.

Example:

dim t as long
t = 10000 * 10000 / 10000 'Overflow

Example 2:

dim t as long
t = 10000! * 10000 / 10000 'Ok
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文