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. SendMessage

SendMessage

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 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.
  • S Offline
    S Offline
    Sakhalean
    wrote on last edited by
    #1

    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?

    X A 2 Replies Last reply
    0
    • S Sakhalean

      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?

      X Offline
      X Offline
      xrg_soft 163 com
      wrote on last edited by
      #2

      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.

      S 1 Reply Last reply
      0
      • X xrg_soft 163 com

        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.

        S Offline
        S Offline
        Sakhalean
        wrote on last edited by
        #3

        s ok thank u

        1 Reply Last reply
        0
        • S Sakhalean

          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?

          A Offline
          A Offline
          Albert Holguin
          wrote on last edited by
          #4

          SendMessage() is a synchronous call, meaning it waits for the code and result of the operation (framework equivalent of making a blocking function call), whereas PostMessage() 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.

          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