Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Windows message queue size

466 views
Skip to first unread message

JoeZ

unread,
Sep 30, 2003, 5:27:55 PM9/30/03
to
Hi,

Is there a maximum size for the message queue, per application (MFC app) or
per thread (CWinThread) ?

TIA, I also appreciate if some one can point a document about this ?


David Lowndes

unread,
Oct 1, 2003, 2:55:53 AM10/1/03
to
>Is there a maximum size for the message queue, per application (MFC app) or
>per thread (CWinThread) ?

Under 16 bit Windows, the queues were a fixed size (alterable via
SetMessageQueue), but under Win32 OS's they're dynamic - there's no
fixed limit.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq

Larry J. Siddens

unread,
Oct 1, 2003, 9:17:30 AM10/1/03
to
There maybe a limit under Win16, but we have an
application that locks the thread (processing the queue)
and another that sends around 20K PostMessages, but less
than 5K get processed. So, the Win32 does have a limit.

To test this, create two threads, and lock one thread
until the other finishes. Send about 5-6K PostMessages
with some indicator, unlock the thread and less than 5K
will be seen.

We found this in our application that communicates over
the network. When the user requrests an action, the
calling thread sends the message and then is locked
waiting for the other thread to signal that it has
received all the information. The other thread reads over
20K records and for each record received would send
PostMessage to the calling thread. When we noticed that
less than 5K of the requested 20K was seen, we started
looking and noticed this.

We solved it by creating a link list with all the records
and passing one PostMessage.

Larry

>.
>

Joseph M. Newcomer

unread,
Oct 1, 2003, 11:11:06 AM10/1/03
to
There is an actual limit in Win2K and higher: 10000 messages. This is documented in the
PostMessage documentation. It is not dynamic and can only be changed by changing the
Registry.
joe

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

David Lowndes

unread,
Oct 1, 2003, 5:58:09 PM10/1/03
to
>There maybe a limit under Win16, but we have an
>application that locks the thread (processing the queue)
>and another that sends around 20K PostMessages, but less
>than 5K get processed.

Larry,

Do the missing PostMessage calls return failure?

Do you have a simple (small amount of source code) repro example to
demonstrate this issue?

Joseph M. Newcomer

unread,
Oct 1, 2003, 11:50:31 PM10/1/03
to
PostMessage returns FALSE if the queue is full.
joe

On Wed, 01 Oct 2003 22:58:09 +0100, David Lowndes <dav...@mvps.org> wrote:

>>There maybe a limit under Win16, but we have an
>>application that locks the thread (processing the queue)
>>and another that sends around 20K PostMessages, but less
>>than 5K get processed.
>
>Larry,
>
>Do the missing PostMessage calls return failure?
>
>Do you have a simple (small amount of source code) repro example to
>demonstrate this issue?
>
>Dave

Joseph M. Newcomer [MVP]

David Lowndes

unread,
Oct 2, 2003, 2:51:25 AM10/2/03
to
>There is an actual limit in Win2K and higher: 10000 messages. This is documented in the
>PostMessage documentation. It is not dynamic and can only be changed by changing the
>Registry.

Aha, you find something new everyday! I'd not seen that before.

Larry J. Siddens

unread,
Oct 7, 2003, 10:50:10 PM10/7/03
to
Yes.

Larry J. Siddens

unread,
Oct 7, 2003, 10:51:09 PM10/7/03
to
Where is that set?
0 new messages