What is the difference between the sendMessage
and postmessage
?
Answer 1, Authority 100%
postmessage – sets a message in the queue, and the code is performed on.
SendMessage – SendMessage Function Stepted message immediately
Answer 2, Authority 250%
(refinement-comment to the answer @asen )
-
and
postmessage
andsendmessage
if you use your terminology, “send a message immediately”, since the only one you can send Messages (with the exception of Nonqueued Messages ) is some inner queue . -
it is implemented because otherwise the
Race Conditions
type 50 streams were sent at the same time madeSendMessage
“would be very problematic. -
Most importantly, What was needed to write about these functions – this is what
SendMessage
We are waiting for the message processing and returns the result andPostMessage
just puts a message in the queue and completely does not care about What happens next. -
The last fact, by the way, is noticeable from their signatures:
bool winpi postmessage (hwnd hwnd, uint msg, WPARAM WPARAM, LPARAM LPARAM); Lresult Winpi SendMessage (Hwnd Hwnd, Uint MSG, WPARAM WPARAM, LPARAM LPARAM);
Answer 3, Authority 100%
SendMessage – Synchronous, PostMessage – asynchronous.