Asked By Malachy Moses
08-Sep-08 08:33 PM

See in-line below ....
On Sep 8, 1:53=A0pm, Denis Adamchuk
is,
e,
hen
The
No it doesn't mean that. Read the documentation again carefully. The
system *delivers* these messages *during* the call to PeekMessage.
Thus, before PeekMessage returns, all sent messages are dispatched
automatically. You don't get these messages back as a result from the
call to PeekMessage. In fact, the documentation explicitly states
that such messages are "nonqueued".
This is the "more complicated" part that I mentioned above, and refers
to a situation where SendMessage has been called from a thread
different from the thread that manages the window's message queue.
Such messages are accumulated in a "separate place" (using the words
of Raymond Chen) that is different from the message queue. Since they
are not queued messages, they must be processed separately from the
message queue. The timing at which they are processed is a priority
timing, ahead of messages in the queue. Thus, when the thread that
manages the window's queue is re-awakened, as soon as it calls a
function like PeekMessage or GetMessage, any messages that are in the
which queued messages are returned for manual dispatching by your
program (i.e., in your program's call to DispatchMessage).
For more information, read this thread from Raymond Chen's blog Old
New Thing: "The various ways of sending a message" at
http://blogs.msdn.com/oldnewthing/archive/2004/11/19/266664.aspx .
The comments are where the meat of the information resides. For
example, selected and re-ordered comments tell us the following:
thread, the window procedure is called immediately by SendMessage().
are posting from *this* thread or another thread, the messages go into
don't technically go into "the message queue" but rather a "separate
place".
directly or indirectly looks at this "separate place" (such as
PeekMessage or GetMessage), the system first checks if there are any
messages in the "separate place" and dispatches them all automatically
(i.e., automatically calls the window procedure). The system then
checks "the message queue" and returns the first matching message."
sent
the
I have never used PM_QS_SENDMESSAGE, and can't talk definitively.
That was one of the questions in the blog I linked to, and the
question remained unanswered. However, according to the documentation
that you linked to, it apparently "Process[es] all sent messages",
which fits into the explanation quoted above.