How is executed a SendMessage from a different thread?
Posted
by Lorenzo
on Stack Overflow
See other posts from Stack Overflow
or by Lorenzo
Published on 2010-05-31T10:16:05Z
Indexed on
2010/05/31
10:23 UTC
Read the original article
Hit count: 195
When we send a message, "if the specified window was created by the calling thread, the window procedure is called immediately as a subroutine".
But "if the specified window was created by a different thread, the system switches to that thread and calls the appropriate window procedure. Messages sent between threads are processed only when the receiving thread executes message retrieval code." (taken from MSDN documentation for SendMessage
).
Now, I don't understand how (or, more appropriately, when) the target windows procedure is called. Of course the target thread will not be preempted (the program counter is not changed). I presume that the call will happen during some wait function (like GetMessage
or PeekMessage
), it is true? That process is documented in detail somewhere?
© Stack Overflow or respective owner