网站首页  词典首页

请输入您要查询的函数:

 

术语 msgwaitformultipleobjectsex
释义 MsgWaitForMultipleObjectsEx
语法:
C++
DWORD WINAPI MsgWaitForMultipleObjectsEx(
__in DWORD nCount,
__in const HANDLE *pHandles,
__in DWORD dwMilliseconds,
__in DWORD dwWakeMask,
__in DWORD dwFlags
);
MsgWaitForMultipleObjectsEx功能
等待,直到一个或多个指定的所有对象是在信号状态,一个I / O完成例程或异步过程调用(APC)是排队到线程,或经过的超时间隔。在对象数组可以包括输入事件对象,指定使用dwWakeMask参数。
参数
nCount [in]
对象句柄数指向pHandles数组中。对象句柄的最大数量减去1 MAXIMUM_WAIT_OBJECTS。
pHandles [in]
一个对象的句柄数组。对于一个对象类型的处理,您可以指定,请参见备注部分本主题后面的名单。该阵列可以包含句柄多种类型的对象。它不能包含相同的处理多个副本。
如果这些处理一个是封闭,而该等待仍悬而未决,该函数的行为是不确定的。
在处理必须有正确的同步访问。有关更多信息,请参阅标准访问权限。
dwMilliseconds的 [in]
在超时间隔时间,以毫秒为单位。如果一个非零值指定的函数等待,直到指定的对象是信号,一个I / O完成例程或APC排队,或经过的时间间隔。如果dwMilliseconds的是零,该函数不进入等待状态,如果条件得不到满足,它总是立即返回。如果dwMilliseconds的是无限的,该函数将返回只有在指定的对象是信号或I / O完成例程或APC排队。
dwWakeMask [in]
输入类型的输入事件对象句柄将被添加到对象句柄数组。此参数可以是一个或多个下列值。
ValueMeaning
QS_ALLEVENTS
0x04BFAn输入,中WM_TIMER,WM_PAINT消息,WM_HOTKEY,或张贴消息在队列中。
此值是一个QS_INPUT,QS_POSTMESSAGE,QS_TIMER,QS_PAINT和QS_HOTKEY组合。
QS_ALLINPUT
0x04FFAny消息在队列中。
此值是一个QS_INPUT,QS_POSTMESSAGE,QS_TIMER,QS_PAINT,QS_HOTKEY和QS_SENDMESSAGE组合。
QS_ALLPOSTMESSAGE
0x0100A发布消息队列中。
清除此值时调用GetMessage或PeekMessage未经过滤的信息。
QS_HOTKEY
0x0080A WM_HOTKEY消息在队列中。
QS_INPUT
0x407An输入消息队列中。
此值是一个QS_MOUSE,QS_KEY和QS_RAWINPUT组合。
Windows 2000中:此值不包括QS_RAWINPUT。
QS_KEY
0x0001A WM_KEYUP,WM_KEYDOWN,WM_SYSKEYUP,或WM_SYSKEYDOWN消息在队列中。
QS_MOUSE
0x0006A WM_MOUSEMOVE消息或鼠标按钮消息(WM_LBUTTONUP,WM_RBUTTONDOWN等)。
此值是一个QS_MOUSEMOVE和QS_MOUSEBUTTON组合。
QS_MOUSEBUTTON
0x0004A鼠标按键消息(WM_LBUTTONUP,WM_RBUTTONDOWN等)。
QS_MOUSEMOVE
0x0002A WM_MOUSEMOVE消息在队列中。
QS_PAINT
0x0020A WM_PAINT消息在队列中。
QS_POSTMESSAGE
0x0008A发布消息队列中。
清除此值时调用GetMessage或PeekMessage,不管您是筛选信息。
QS_RAWINPUT
0x0400A原始输入消息队列中。有关更多信息,请参阅原始输入。
Windows 2000中:此值不支持。
QS_SENDMESSAGE
0x0040A消息由另一个线程或应用程序发送的队列中。
QS_TIMER
0x0010A WM_TIMER消息在队列中。
dwFlags [in]
在等待类型。此参数可以是一个或多个下列值。
ValueMeaning
0The函数返回时,任何一个对象发出信号。返回值表示对象的情况引起的函数返回。
MWMO_ALERTABLE
0x0002The函数也返回如果APC的排队与QueueUserAPC线程,而线程在等待状态。
MWMO_INPUTAVAILABLE
0x0004The函数返回如果输入队列存在,即使输入已经看到(但不删除)使用诸如PeekMessage调用另一个函数。
MWMO_WAITALL
0x0001The函数返回时,在pHandles数组中的所有对象是一个输入信号,并已收到的事件,都在同一时间。
返回值
如果函数成功,返回值表示该事件导致该函数返回。它可以是下列值之一。 (请注意,WAIT_OBJECT_0被定义为0和WAIT_ABANDONED_0是0x00000080L定义。)
返回代码/ valueDescription
WAIT_OBJECT_0到(WAIT_OBJECT_0 + nCount - 1)如果MWMO_WAITALL标志使用时,返回值表明,所有指定对象的状态信号。否则,返回值减去WAIT_OBJECT_0表示的对象,造成函数返回pHandles数组的索引。
WAIT_OBJECT_0 +在dwWakeMask参数中指定的类型nCountNew输入可在线程的输入队列。如PeekMessage,GetMessage,GetQueueStatus功能,并WaitMessage邮件标记为旧的邮件队列。因此,在调用这些函数,随后调用MsgWaitForMultipleObjectsEx人会不会返回,直到指定类型的新的输入到达。
此值也返回后一个系统事件,需要线程的行动,如前景激活的发生。因此,MsgWaitForMultipleObjectsEx可以返回即使没有提供适当的投入,即使dwWakeMask设置为0。如果发生这种情况,调用GetMessage或PeekMessage来处理,然后再尝试调用MsgWaitForMultipleObjectsEx系统事件再次。
WAIT_ABANDONED_0至(WAIT_ABANDONED_0 + nCount - 1)如果MWMO_WAITALL标志使用时,返回值表明,所有指定对象的状态信号,至少其中一个对象是一个被遗弃的互斥对象。否则,返回值减去WAIT_ABANDONED_0指示互斥对象被遗弃导致该函数返回pHandles数组的索引。对互斥对象的所有权被授予调用线程,而互斥设置为无信号。
假如是互斥保护的持久状态的信息,您应该检查它的一致性。
WAIT_IO_COMPLETION
0x000000C0LThe等待已结束一个或多个用户模式异步过程调用(APC)的排队到线程。
WAIT_TIMEOUT
258LThe超时时间间隔过去了,而是由dwFlags和dwWakeMask参数中指定的条件未能得到满足。
WAIT_FAILED
(DWORD值)0xFFFFFFFFThe函数失败。为了获得更多错误信息,调用GetLastError。
备注
该MsgWaitForMultipleObjectsEx函数确定是否dwWakeMask和dwFlags规定的条件得到满足。如果条件没有得到满足,调用线程进入等待,直到标准的条件下等待状态已经达到或超时间隔经过的。
当dwFlags是零,此功能检查,以便在处理与数组的索引0开始,直到一个对象发出信号。如果多个对象成为暗示,该函数返回首先处理的信号,其目的是数组的索引。
MsgWaitForMultipleObjectsEx不会返回如果在消息队列中指定的类型后,线程调用一个函数来检查队列中读输入,除非您使用MWMO_INPUTAVAILABLE标志。这是因为,如PeekMessage,GetMessage,GetQueueStatus功能,WaitMessage检查队列,然后更改队列的状态信息,以便输入不再被认为是新的。随后的调用MsgWaitForMultipleObjectsEx不会返回,直到指定类型的新的输入到达,除非您使用MWMO_INPUTAVAILABLE标志。如果这个标志不使用现有的未读输入(之前收到的最后一次检查的线程队列)被忽略。
函数修改了某些类型的同步对象的状态。改造只对一个或多个对象的信号状态发生所造成的函数返回。例如,该系统减少了一个信号量对象计数。有关详细信息,请参阅个别同步对象文件。
该MsgWaitForMultipleObjectsEx功能可以指定处理的,在下面的对象数组pHandles任何类型:
更改通知
控制台输入
事件
内存资源通知
互斥
工艺
信号量
线
可等待定时器
在QS_ALLPOSTMESSAGE和QS_POSTMESSAGE旗帜不同时被清除。 QS_POSTMESSAGE被清除时调用GetMessage或PeekMessage,不管您是筛选信息。 QS_ALLPOSTMESSAGE被清除时调用GetMessage或未经过滤的信息(wMsgFilterMin和wMsgFilterMax PeekMessage 0)。这可能是有用的当您调用PeekMessage多次获得不同范围的信息。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinuser.h(头文件:winuser.h)
LibraryUser32.lib
DLLUser32.dll
参见
同步功能
等待函数
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==MsgWaitForMultipleObjectsEx Function
Waits until one or all of the specified objects are in the signaled state, an I/O completion routine or asynchronous procedure call (APC) is queued to the thread, or the time-out interval elapses. The array of objects can include input event objects, which you specify using the dwWakeMask parameter.
Syntax
C++
DWORD WINAPI MsgWaitForMultipleObjectsEx(
__in DWORD nCount,
__in const HANDLE *pHandles,
__in DWORD dwMilliseconds,
__in DWORD dwWakeMask,
__in DWORD dwFlags
);
Parameters
nCount [in]
The number of object handles in the array pointed to by pHandles. The maximum number of object handles is MAXIMUM_WAIT_OBJECTS minus one.
pHandles [in]
An array of object handles. For a list of the object types whose handles you can specify, see the Remarks section later in this topic. The array can contain handles to multiple types of objects. It may not contain multiple copies of the same handle.
If one of these handles is closed while the wait is still pending, the function's behavior is undefined.
The handles must have the SYNCHRONIZE access right. For more information, see Standard Access Rights .
dwMilliseconds [in]
The time-out interval, in milliseconds. If a nonzero value is specified, the function waits until the specified objects are signaled, an I/O completion routine or APC is queued, or the interval elapses. If dwMilliseconds is zero, the function does not enter a wait state if the criteria is not met; it always returns immediately. If dwMilliseconds is INFINITE, the function will return only when the specified objects are signaled or an I/O completion routine or APC is queued.
dwWakeMask [in]
The input types for which an input event object handle will be added to the array of object handles. This parameter can be one or more of the following values.
ValueMeaning
QS_ALLEVENTS
0x04BFAn input, WM_TIMER , WM_PAINT , WM_HOTKEY , or posted message is in the queue.
This value is a combination of QS_INPUT, QS_POSTMESSAGE, QS_TIMER, QS_PAINT, and QS_HOTKEY.
QS_ALLINPUT
0x04FFAny message is in the queue.
This value is a combination of QS_INPUT, QS_POSTMESSAGE, QS_TIMER, QS_PAINT, QS_HOTKEY, and QS_SENDMESSAGE.
QS_ALLPOSTMESSAGE
0x0100A posted message is in the queue.
This value is cleared when you call GetMessage or PeekMessage without filtering messages.
QS_HOTKEY
0x0080A WM_HOTKEY message is in the queue.
QS_INPUT
0x407An input message is in the queue.
This value is a combination of QS_MOUSE, QS_KEY, and QS_RAWINPUT.
Windows 2000: This value does not include QS_RAWINPUT.
QS_KEY
0x0001A WM_KEYUP , WM_KEYDOWN , WM_SYSKEYUP , or WM_SYSKEYDOWN message is in the queue.
QS_MOUSE
0x0006A WM_MOUSEMOVE message or mouse-button message (WM_LBUTTONUP, WM_RBUTTONDOWN , and so on).
This value is a combination of QS_MOUSEMOVE and QS_MOUSEBUTTON.
QS_MOUSEBUTTON
0x0004A mouse-button message (WM_LBUTTONUP, WM_RBUTTONDOWN, and so on).
QS_MOUSEMOVE
0x0002A WM_MOUSEMOVE message is in the queue.
QS_PAINT
0x0020A WM_PAINT message is in the queue.
QS_POSTMESSAGE
0x0008A posted message is in the queue.
This value is cleared when you call GetMessage or PeekMessage, whether or not you are filtering messages.
QS_RAWINPUT
0x0400A raw input message is in the queue. For more information, see Raw Input .
Windows 2000: This value is not supported.
QS_SENDMESSAGE
0x0040A message sent by another thread or application is in the queue.
QS_TIMER
0x0010A WM_TIMER message is in the queue.

dwFlags [in]
The wait type. This parameter can be one or more of the following values.
ValueMeaning
0The function returns when any one of the objects is signaled. The return value indicates the object whose state caused the function to return.
MWMO_ALERTABLE
0x0002The function also returns if an APC has been queued to the thread with QueueUserAPC while the thread is in the waiting state.
MWMO_INPUTAVAILABLE
0x0004The function returns if input exists for the queue, even if the input has been seen (but not removed) using a call to another function, such as PeekMessage .
MWMO_WAITALL
0x0001The function returns when all objects in the pHandles array are signaled and an input event has been received, all at the same time.

Return Value
If the function succeeds, the return value indicates the event that caused the function to return. It can be one of the following values. (Note that WAIT_OBJECT_0 is defined as 0 and WAIT_ABANDONED_0 is defined as 0x00000080L.)
Return code/valueDescription
WAIT_OBJECT_0 to (WAIT_OBJECT_0 + nCount - 1)If the MWMO_WAITALL flag is used, the return value indicates that the state of all specified objects is signaled. Otherwise, the return value minus WAIT_OBJECT_0 indicates the pHandles array index of the object that caused the function to return.
WAIT_OBJECT_0 + nCountNew input of the type specified in the dwWakeMask parameter is available in the thread's input queue. Functions such as PeekMessage , GetMessage , GetQueueStatus , and WaitMessage mark messages in the queue as old messages. Therefore, after you call one of these functions, a subsequent call to MsgWaitForMultipleObjectsEx will not return until new input of the specified type arrives.
This value is also returned upon the occurrence of a system event that requires the thread's action, such as foreground activation. Therefore, MsgWaitForMultipleObjectsEx can return even though no appropriate input is available and even if dwWakeMask is set to 0. If this occurs, call GetMessage or PeekMessage to process the system event before trying the call to MsgWaitForMultipleObjectsEx again.
WAIT_ABANDONED_0 to (WAIT_ABANDONED_0 + nCount - 1)If the MWMO_WAITALL flag is used, the return value indicates that the state of all specified objects is signaled and at least one of the objects is an abandoned mutex object. Otherwise, the return value minus WAIT_ABANDONED_0 indicates the pHandles array index of an abandoned mutex object that caused the function to return. Ownership of the mutex object is granted to the calling thread, and the mutex is set to nonsignaled.
If the mutex was protecting persistent state information, you should check it for consistency.
WAIT_IO_COMPLETION
0x000000C0LThe wait was ended by one or more user-mode asynchronous procedure calls (APC) queued to the thread.
WAIT_TIMEOUT
258LThe time-out interval elapsed, but the conditions specified by the dwFlags and dwWakeMask parameters were not met.
WAIT_FAILED
(DWORD)0xFFFFFFFFThe function has failed. To get extended error information, call GetLastError .

Remarks
The MsgWaitForMultipleObjectsEx function determines whether the conditions specified by dwWakeMask and dwFlags have been met. If the conditions have not been met, the calling thread enters the wait state until the conditions of the wait criteria have been met or the time-out interval elapses.
When dwFlags is zero, this function checks the handles in the array in order starting with index 0, until one of the objects is signaled. If multiple objects become signaled, the function returns the index of the first handle in the array whose object was signaled.
MsgWaitForMultipleObjectsEx does not return if there is unread input of the specified type in the message queue after the thread has called a function to check the queue, unless you use the MWMO_INPUTAVAILABLE flag. This is because functions such as PeekMessage , GetMessage , GetQueueStatus , and WaitMessage check the queue and then change the state information for the queue so that the input is no longer considered new. A subsequent call to MsgWaitForMultipleObjectsEx will not return until new input of the specified type arrives, unless you use the MWMO_INPUTAVAILABLE flag. If this flag is not used, the existing unread input (received prior to the last time the thread checked the queue) is ignored.
The function modifies the state of some types of synchronization objects. Modification occurs only for the object or objects whose signaled state caused the function to return. For example, the system decreases the count of a semaphore object by one. For more information, see the documentation for the individual synchronization objects.
The MsgWaitForMultipleObjectsEx function can specify handles of any of the following object types in the pHandles array:
Change notification
Console input
Event
Memory resource notification
Mutex
Process
Semaphore
Thread
Waitable timer
The QS_ALLPOSTMESSAGE and QS_POSTMESSAGE flags differ in when they are cleared. QS_POSTMESSAGE is cleared when you call GetMessage or PeekMessage , whether or not you are filtering messages. QS_ALLPOSTMESSAGE is cleared when you call GetMessage or PeekMessage without filtering messages (wMsgFilterMin and wMsgFilterMax are 0). This can be useful when you call PeekMessage multiple times to get messages in different ranges.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinuser.h (include Windows.h)
LibraryUser32.lib
DLLUser32.dll
See Also
Synchronization Functions
Wait Functions
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms684245(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 9:21:43