SendMessage
-
Hi All, I have a doubt. PostMessage() will post the message and returns immediately won't wait for Message to complete. where as SendMessage() will post the message and will not return till the message is completed. My doubt is why we have to wait in SendMessage() till the message is completed. Can any body can clarify my doubt?
-
Hi All, I have a doubt. PostMessage() will post the message and returns immediately won't wait for Message to complete. where as SendMessage() will post the message and will not return till the message is completed. My doubt is why we have to wait in SendMessage() till the message is completed. Can any body can clarify my doubt?
Sometimes we need to know the retult of the message and using the return value or wparam or lparam of the message. Take WM_GETTEXT as an example. Only after the destination window processed this messasge and filled the lparam with it's text,can our program do something accordingly. In such case we must use SendMessage.
-
Sometimes we need to know the retult of the message and using the return value or wparam or lparam of the message. Take WM_GETTEXT as an example. Only after the destination window processed this messasge and filled the lparam with it's text,can our program do something accordingly. In such case we must use SendMessage.
-
Hi All, I have a doubt. PostMessage() will post the message and returns immediately won't wait for Message to complete. where as SendMessage() will post the message and will not return till the message is completed. My doubt is why we have to wait in SendMessage() till the message is completed. Can any body can clarify my doubt?
SendMessage()
is a synchronous call, meaning it waits for the code and result of the operation (framework equivalent of making a blocking function call), whereasPostMessage()
is asynchronous, meaning there's no waiting for result. Where is either useful? -SendMessage()
: Your continuation of execution depends on the result of the operation and/or the CWnd's lie in the same thread (blocking calls are a non-issue). -PostMessage()
: Non-blocking is essential, such is the case for threaded programming.