win12.hlp (Table of Contents; Topic list)
WinWaitMsg (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINMESSAGEMGR
 
BOOL WinWaitMsg(hab, msgFirst, msgLast)
HAB hab;            /* handle of the anchor block */
USHORT msgFirst;    /* first message              */
USHORT msgLast;     /* last message               */
 
The WinWaitMsg function waits for a filtered message. It awaits a message
that meets both of the following requirements: the message arrived after a
call to the WinGetMsg or the WinPeekMsg function that returned TRUE; the
message conforms to the filtering criteria specified by the msgFirst and
msgLast parameters.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hab        Identifies the anchor block.
 
msgFirst   Specifies the first message.
 
msgLast    Specifies the last message.
 
Return Value
 
The return value is TRUE if the function is successful or FALSE if an error
occurs.
 
Comments
 
Filtering allows an application to process messages in a different order
than the one in the message queue. Filtering is used so the application can
receive messages of a particular type only, rather than receiving other
types of messages at an inconvenient point in the logic of the application.
For example, when a "mouse button down" message is received, the application
can use filtering to wait for the "mouse button up" message without having
to process other messages.
 
Keystrokes are passed to the WinTranslateAccel function. This means that
accelerator keys are translated into WM_COMMAND or WM_SYSCOMMAND messages
and are not received as WM_CHAR messages by the application.
 
If both msgFirst and msgLast are zero, then WinWaitMsg will return when any
message is placed in the queue. This can be used in conjunction with the
WinPeekMsg function to create a WinGetMsg type loop that does not remove
messages from the queue.
 
The constants WM_MOUSEFIRST and WM_MOUSELAST can be used for msgFirst and
msgLast to filter all but mouse messages.
 
The constants WM_BUTTONCLICKFIRST and WM_BUTTONCLICKLAST can be used for
msgFirst and msgLast to filter all but mouse button messages.
 
The constants WM_DDE_FIRST and WM_DDE_LAST can be used for msgFirst and
msgLast to filter all but dynamic data exchange messages.
 
See Also
 
WinGetMsg, WinPeekMsg, WinTranslateAccel