question

PiuBhole-6685 avatar image
0 Votes"
PiuBhole-6685 asked RLWA32-6355 answered

Empty the Message Queue in Windows API

I am using Windows api PostThreadMessage to add the message in one thread and GetMessage the message to retrieve the message .From MSDN docs it is clear that Message Queue is limited to 10,000 message . But I am unable to test it. As I want to test it before 5,000 message . I have not find any API to check the message Queue .

What I tried: res = PostThreadMessage . If ret is 0 i.e post thread fail and using GetLastError() it get the error message .

But I want to check before the PostThreadMessage that if Message Queue Empty or full ?
If it full how to Empty the Message Queue.

windows-api
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RLWA32-6355 avatar image
0 Votes"
RLWA32-6355 answered

What purpose is served by seeing if the message queue of the target thread is full?

The posting thread must handle the situation if the attempt to post a message to the Target thread cannot be accomplished regardless of whether the reason is because postthreadmessage failed or was not attempted because the message queue is already full.

I suggest that you determine the reason why the Target thread is not pumping messages with enough frequency to prevent the 10,000 message limit from being reached.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Castorix31 avatar image
0 Votes"
Castorix31 answered
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.