Ole32CoWaitForMultipleHandles Method
Waits for specified handles to be signaled or for a specified timeout period to elapse.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Ole32.dll", SetLastError = true)]
public static HResult CoWaitForMultipleHandles(
CoWaitForMultipleHandlesFlags flags,
uint signalTimeout,
uint handleCount,
IntPtr[] handles,
ref uint refHandleIndex
)
<DllImportAttribute("Ole32.dll", SetLastError := true>]
Public Shared Function CoWaitForMultipleHandles (
flags As CoWaitForMultipleHandlesFlags,
signalTimeout As UInteger,
handleCount As UInteger,
handles As IntPtr(),
ByRef refHandleIndex As UInteger
) As HResult
Dim flags As CoWaitForMultipleHandlesFlags
Dim signalTimeout As UInteger
Dim handleCount As UInteger
Dim handles As IntPtr()
Dim refHandleIndex As UInteger
Dim returnValue As HResult
returnValue = Ole32.CoWaitForMultipleHandles(flags,
signalTimeout, handleCount, handles,
refHandleIndex)
public:
[DllImportAttribute(L"Ole32.dll", SetLastError = true)]
static HResult CoWaitForMultipleHandles(
CoWaitForMultipleHandlesFlags flags,
unsigned int signalTimeout,
unsigned int handleCount,
array<IntPtr>^ handles,
unsigned int% refHandleIndex
)
[<DllImportAttribute("Ole32.dll", SetLastError = true)>]
static member CoWaitForMultipleHandles :
flags : CoWaitForMultipleHandlesFlags *
signalTimeout : uint32 *
handleCount : uint32 *
handles : IntPtr[] *
refHandleIndex : uint32 byref -> HResult
No code example is currently available or this language may not be supported.
- flags CoWaitForMultipleHandlesFlags
-
The handle wait options.
- signalTimeout UInt32
-
The timeout period, in milliseconds.
- handleCount UInt32
-
The number of elements in the pHandles array.
- handles IntPtr
-
An array of handles.
- refHandleIndex UInt32
-
A pointer to a variable that, when the returned status is S_OK,
receives a value indicating the event that caused the function to return.
This value is usually the index into handles for the handle that was signaled.
If handles includes one or more handles to mutex objects,
a value between WAIT_ABANDONED_0 and (WAIT_ABANDONED_0 + nCount 1) indicates the
index into handles for the mutex that was abandoned.
If the Alertable flag is set in flags,
a value of WAIT_IO_COMPLETION indicates the wait was ended by
one or more user-mode asynchronous procedure calls (APC) queued to the thread.
HResult
Returns
S_OK on success, or other
HResult if an error occurs.
Note that the return value of
CoWaitForMultipleHandles(CoWaitForMultipleHandlesFlags, UInt32, UInt32, IntPtr, UInt32) can be nondeterministic if the
Alertable flag is set in
flags,
or if
handles includes one or more handles to mutex objects.
The recommended workaround is to call SetLastError(ERROR_SUCCESS) before
CoWaitForMultipleHandles(CoWaitForMultipleHandlesFlags, UInt32, UInt32, IntPtr, UInt32).
This is a code example.
No code example is currently available or this language may not be supported.
Dim mre As New ManualResetEvent(initialState:=False)
Dim waitHandles As IntPtr() = {mre.SafeWaitHandle.DangerousGetHandle()}
Dim handleLength As UInteger = CUInt(waitHandles.Length)
Dim handleIndex As UInteger
Dim signalTimeout As UInteger = 0UI
Do While True
' Intensive work here...
Dim result As HResult = NativeMethods.CoWaitForMultipleHandles(CoWaitForMultipleHandlesFlags.Default, signalTimeout, handleLength, waitHandles, handleIndex)
Loop
mre.Dispose()
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.