FlushEvents
FlushEvents Discard all or selected events from event queue
#include <OSEvents.h> Event Manager
void FlushEvents( eventMask, stopMask );
short eventMask ; which events to discard; 0xFFFF=all
short stopMask ; flush until one of these is found; 0=flush all
FlushEvents discards all (or selected) events chronologically, until it hits
a specified event type. It is often used at the beginning of a program to empty
the event queue of spurious keystrokes or clicks left over from the Finder.
eventMask specifies which event(s) should be flushed. It is a 16-bit binary
mask where a 1 elects to flush an event and a 0 keeps the event. The
most common usage is to use eventMask=everyEvent, defined in
Events.h as 0xFFFF. See Event Mask for details.
stopMask specifies which events (if any) should stop the flushing process.
For instance, if you want to discard all events up to the next
keystroke, use stopMask = keyDown. A value of 0 means to keep
flushing to the end of the queue.
Returns: none

Notes: To purge all events from the queue, use:
FlushEvents( everyEvent, 0 );
Note: FlushEvents will not remove pending highLevelEvents.