Author: William Gerbert
Emptying the keyboard queue (key messages)
Answer:
Use the procedure below to remove all pending key messages from your own message
queue.
Note that you only can empty your own application's message queue, not from that of
another process.
1 program Dummy;
2 3 procedure EmptyKeyQueue;
4 var5 msg: TMsg;
6 begin7 while PeekMessage(msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE or PM_NOYIELD) do8 ;
9 end;
10 11 begin12 EmptyKeyQueue;
13 end.