Discuss this help topic in MsgConnect Forum

Filter: C++  Pascal  C#  VB.NET  Java  Java ME  ActiveX  DLL 



Messenger.MsgWaitForMultipleObjects

Messenger     See also    


Returns when an incoming message is available or one (or all) handles change their state to signaled.

Declaration

[C++]
    unsigned long MsgWaitForMultipleObjects(unsigned long nCount, void* pHandles, bool fWaitAll, unsigned long dwMilliseconds);

[Pascal]
    function MsgWaitForMultipleObjects(nCount : DWORD; var pHandles; fWaitAll : boolean; dwMilliseconds : DWORD) : DWORD;

[VB6]
    Sub MsgWaitForMultipleObjects(nCount As Long, pHandles() As Long, fWaitAll As Boolean, dwMilliseconds As Long)

[ActiveX]
     HRESULT _stdcall MsgWaitForMultipleObjects([in] unsigned long nCount, [in] SAFEARRAY(long) pHandles, [in] VARIANT_BOOL fWaitAll, [in] unsigned long dwMilliseconds);

[C#]
    public uint MsgWaitForMultipleObjects(uint nCount, ref WaitHandle[] pHandles, bool fWaitAll, uint dwMilliseconds);

[VB.NET]
    Public Function MsgWaitForMultipleObjects(ByVal nCount As Integer, ByRef pHandles As WaitHandle(), ByVal fWaitAll As Boolean, ByVal dwMilliseconds As Integer) As UInt32

[Java]
    not applicable;

[Java ME]
    not applicable;

[DLL]
    unsigned long __stdcall MCMessengerMsgWaitForMultipleObjects(HMCMessenger h, unsigned long nCount, HANDLE* pHandles, bool fWaitAll, unsigned long dwMilliseconds);

Parameters

  • [DLL]h - handle to the Messenger object that was returned by Create method

  • nCount - the number of objects in pHandles array
  • pHandles - an array of handles which are to be waited for. The number of elements in array is defined by nCount
  • fWaitAll - Specifies whether Messenger should wait until all objects change their state or until at least one object changes it's state
  • dwMilliseconds - Defines time to wait for the objects. If the time elapses the specified value, the method returns with result value set to TIMEOUT.
    Set this parameter to INFINITE to wait infinitely.

Return value

    The index of the object that has signalled in the array or MCE_TIMEOUT value if time has expired or MCE_FAILED if some object was destroyed.

Description

    This method returns when one of the following events happens:

  • time specified by dwMilliseconds parameter is elapsed;
  • there is an incoming message in the input queue;
  • if fWaitAll is set, -- when all objects change their state to signaled;
  • if fWaitAll is not set, -- when any of the objects changes it's state to singaled;
  • if one of the objects is destroyed.
    This method together with GetMessage, PeekMessage and MessageProcessed is an alternative to using Queues.

See also:     Queue class     MCMessage structure     GetMessage     PeekMessage     MessageProcessed    

Discuss this help topic in MsgConnect Forum