Clearing the Message Queue of a specific message
Posted on 1998-05-13
I have a window that receives a lot of userdefined messages which are user defined ( WM_USER + X ). When I process one of this messages I want to clear the message queue of all other instances of the same message.
This I have been doing buy calling
PeekMessage( &msg, this, messageID, messageID, PM_REMOVE );
This works fine but with one exception.
The exception is that a another thread SENDS a message to the window and PeekMessage takes the message processis it. This would be ok if the message sent by the other tread wasn't a message forcing the window to close ( WM_CLOSE ). Now when the PeekMessage function returns the window has been destroyed.
So the question is this. Can I clear the queue of a specific message in a diffrent way or can a force PeekMessage not to process other messages?