问题描述
我正在使用别人编写的一些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
???
感谢您的帮助.
推荐答案
WaitForSingleObject 实际上是一个DWORD
,它是一个 unsigned 32位整数. INFINITE
定义为0xFFFFFFFF
,但是映射为无符号类型的-1会在大多数整数表示形式中包装并变为该值.
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.
有效,是的.
这篇关于在WaitForSingleObject中,timeout = INFINITE是否等于timeout = -1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!