在WaitForSingleObject中,timeout = INFINITE是否等于timeout = -1? [英] In WaitForSingleObject, is timeout=INFINITE the same as timeout=-1?

查看:290
本文介绍了在WaitForSingleObject中,timeout = INFINITE是否等于timeout = -1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用别人编写的一些Visual Basic for Applications(VB 6.3)代码,他们已经编写了:

I'm working with some Visual Basic for Applications (VB 6.3) code written by someone else, and they've written:

WaitForSingleObject SEI.hProcess, -1

此过程出现的过程应该在文本框中返回一些数据;有时它无法返回任何东西,我认为是因为这个原因,可能是因为它超时了.该代码是否与以下代码相同:

The process this appears in is supposed to return some data in a text box; sometimes it fails to return anything, and I think it's because of this, possibly because it's its timing out. Is that code the same as:

WaitForSingleObject SEI.hProcess, INFINITE

???

感谢您的帮助.

推荐答案

The timeout for WaitForSingleObject is actually a DWORD, which is an unsigned 32 bit integer. INFINITE is defined as 0xFFFFFFFF, but -1 mapped into an unsigned type wraps and becomes this value in most integer representations.

该代码是否与以下代码相同:

Is that code the same as:

有效,是的.

这篇关于在WaitForSingleObject中,timeout = INFINITE是否等于timeout = -1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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