Partager via


IVsCommonMessagePump.ModalWaitForObjects Method

Use this method to wait for objects to signal (likely by some background processing) while keeping VS responsive.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assemblies:   Microsoft.VisualStudio.Shell.Interop.10.0 (in Microsoft.VisualStudio.Shell.Interop.10.0.dll)
  Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)

Syntax

'Declaration
Function ModalWaitForObjects ( _
    rgHandles As IntPtr(), _
    cHandles As UInteger, _
    <OutAttribute> ByRef pdwWaitResult As UInteger _
) As Integer
int ModalWaitForObjects(
    IntPtr[] rgHandles,
    uint cHandles,
    out uint pdwWaitResult
)
int ModalWaitForObjects(
    [InAttribute] array<IntPtr>^ rgHandles, 
    [InAttribute] unsigned int cHandles, 
    [OutAttribute] unsigned int% pdwWaitResult
)
abstract ModalWaitForObjects : 
        rgHandles:IntPtr[] * 
        cHandles:uint32 * 
        pdwWaitResult:uint32 byref -> int
function ModalWaitForObjects(
    rgHandles : IntPtr[], 
    cHandles : uint, 
    pdwWaitResult : uint
) : int

Parameters

  • rgHandles
    Type: array<IntPtr[]

    The array containing the handles of the objects to wait on.

  • cHandles
    Type: UInt32

    The number of handles in the array. The maximum is 64.

  • pdwWaitResult
    Type: UInt32%

    [out] The result that is set when the wait condition was met (i.e., when the method returned S_OK):

    1. WAIT_OBJECT_0 to (WAIT_OBJECT_0 + cHandles - 1) indicates the signaled object (applies only when fWaitForAllObjects is false).

    2. WAIT_OBJECT_0 if fWaitForAllObjects was true.

    3. WAIT_TIMEOUT the time-out interval elapsed before the condition specified by fWaitForAllObjects was met.

Return Value

Type: Int32
S_OK if the wait condition was met; the pdwWaitResult parameter will contain more information about the wait result. Returns E_PENDING if the method had to quit because the user cancelled the wait operation. E_ABORTif WM_QUIT was received.

Remarks

This is the preferred method to use in this interface. It does not require the consumer to implement anything. The method automatically puts the IDE in a modal state, which reduces the risk of reentrancy. The method also handles displays the default UI that explains the reason for the wait. This wait UI is shown roughly 2 seconds after the wait has been initiated.

.NET Framework Security

See Also

Reference

IVsCommonMessagePump Interface

Microsoft.VisualStudio.Shell.Interop Namespace