GetQueueStatus

  DWORD GetQueueStatus(fuFlags)    
  UINT fuFlags; /* queue-status flags */

The GetQueueStatus function returns a code that indicates the type of messages in the calling thread's message queue.

This function is very fast and is typically used inside speed-critical loops to determine whether the GetMessage or PeekMessage function should be called to process input.

GetQueueStatus returns two sets of information: whether any new messages have been added to the queue since GetQueueStatus, GetMessage, or PeekMessage was last called, and what kinds of messages are currently in the queue.

Parameters

fuFlags

Specifies the queue-status flags that indicate the types of messages to check for. This parameter can be a combination of the following values:

Value Description

QS_KEY A WM_CHAR message is in the queue.
QS_MOUSE A WM_MOUSEMOVE or WM_*BUTTON* message is in the queue.
QS_MOUSEMOVE A WM_MOUSEMOVE message is in the queue.
QS_MOUSEBUTTON A WM_*BUTTON* message is in the queue.
QS_PAINT A WM_PAINT message is in the queue.
QS_POSTMESSAGE A posted message other than those listed above is in the queue.
QS_SENDMESSAGE A message sent by another thread or application is in the queue.
QS_TIMER A WM_TIMER message is in the queue.
QS_HOTKEY A hot key message is in the queue.
QS_INPUT An input message is in the queue.
QS_ALLEVENTS Any message is in the queue.

Return Value

The high-order word of the return value specifies QS_ flags that indicate the types of messages currently in the queue. The low-order word specifies QS_ flags that indicate the types of messages added to the queue and are still in the queue since the last call to the GetQueueStatus, GetMessage, or PeekMessage function.

Comments

The existence of a QS_ flag in the return value does not guarantee that a subsequent call to the PeekMessage or GetMessage function will return a message. GetMessage and PeekMessage perform some internal filtering that may cause the message to be processed internally. For this reason, the return value from GetQueueStatus should be considered only hints as to whether GetMessage or PeekMessage should be called.

See Also

GetInputState, GetMessage, PeekMessage