Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Message loop Question

Message loop Question

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RaajaOfSelf
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • R RaajaOfSelf

      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

      C Offline
      C Offline
      Cool Ju
      wrote on last edited by
      #2

      Hi, Try SendMessageTimeOut() Bye Cool Ju :cool: Dream Ur Destiny

      R 1 Reply Last reply
      0
      • C Cool Ju

        Hi, Try SendMessageTimeOut() Bye Cool Ju :cool: Dream Ur Destiny

        R Offline
        R Offline
        RaajaOfSelf
        wrote on last edited by
        #3

        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

        C 1 Reply Last reply
        0
        • R RaajaOfSelf

          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

          C Offline
          C Offline
          Cool Ju
          wrote on last edited by
          #4

          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

          R 1 Reply Last reply
          0
          • C Cool Ju

            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

            R Offline
            R Offline
            RaajaOfSelf
            wrote on last edited by
            #5

            Thanks !!That does answer my question . Cause is my effort; Effect is God's effort

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups