Message loop Question
-
As i have understood the message loop dispatches messages synchronously.i.e it executes the handler to that message and then moves to another message . Also ,Sendmessage(MESSAGE1) call is synchronous i.e. it executes the handler for MESSAGE1 and then returns. WIth this assumption ,iam posting this question. Let's say i have handled the KEYDOWN message as OnKeyDown(). I do this OnKeyDOwn() { SendMessage(WM_MOUSEMove...) } Iam expecting that SendMessage() as opposed to PostMessage should create a deadlock as it executes synchronously-Its trying to execute /put the message in the same loop from where it was called .But it does not happen .Can Somebody explain this ? Does this mean SendMessage() does not post the message in the message loop ,but directly calls WndProc() or something like that ? Cause is my effort; Effect is God's effort -- modified at 0:48 Tuesday 22nd November, 2005
-
As i have understood the message loop dispatches messages synchronously.i.e it executes the handler to that message and then moves to another message . Also ,Sendmessage(MESSAGE1) call is synchronous i.e. it executes the handler for MESSAGE1 and then returns. WIth this assumption ,iam posting this question. Let's say i have handled the KEYDOWN message as OnKeyDown(). I do this OnKeyDOwn() { SendMessage(WM_MOUSEMove...) } Iam expecting that SendMessage() as opposed to PostMessage should create a deadlock as it executes synchronously-Its trying to execute /put the message in the same loop from where it was called .But it does not happen .Can Somebody explain this ? Does this mean SendMessage() does not post the message in the message loop ,but directly calls WndProc() or something like that ? Cause is my effort; Effect is God's effort -- modified at 0:48 Tuesday 22nd November, 2005
-
My question was that i expected an dead lock but it did not happen .I just wanted to understand whats really happening behind the scenes of Send Message() ANyway ,Thanks ! Cause is my effort; Effect is God's effort
-
My question was that i expected an dead lock but it did not happen .I just wanted to understand whats really happening behind the scenes of Send Message() ANyway ,Thanks ! Cause is my effort; Effect is God's effort
Hi, hope this answers ur question If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine. 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. The sending thread is blocked until the receiving thread processes the message. However, the sending thread will process incoming nonqueued messages while waiting for its message to be processed. To prevent this, use SendMessageTimeout with SMTO_BLOCK set. For more information on nonqueued messages WM_KEYDOWN is a non-queued message. Bye Cool Ju :cool: Dream Ur Destiny
-
Hi, hope this answers ur question If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine. 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. The sending thread is blocked until the receiving thread processes the message. However, the sending thread will process incoming nonqueued messages while waiting for its message to be processed. To prevent this, use SendMessageTimeout with SMTO_BLOCK set. For more information on nonqueued messages WM_KEYDOWN is a non-queued message. Bye Cool Ju :cool: Dream Ur Destiny
Thanks !!That does answer my question . Cause is my effort; Effect is God's effort