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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. PostMessage - What should the handler return?

PostMessage - What should the handler return?

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

    I've created a handler for a user defined message with the following declaration:

    afx_msg LRESULT OnIdleScan(WPARAM wPar, LPARAM lPar);

    It works, but what value (of type LRESULT) should the function return, and what does the system do with this? I assume it is not passed back via PostMessage, because it doesn't wait for the handler to execute. I'm arbitrarily returning 0 at present. Best Regards Cliff Hatch

    R 1 Reply Last reply
    0
    • C Cliff Hatch

      I've created a handler for a user defined message with the following declaration:

      afx_msg LRESULT OnIdleScan(WPARAM wPar, LPARAM lPar);

      It works, but what value (of type LRESULT) should the function return, and what does the system do with this? I assume it is not passed back via PostMessage, because it doesn't wait for the handler to execute. I'm arbitrarily returning 0 at present. Best Regards Cliff Hatch

      R Offline
      R Offline
      RChin
      wrote on last edited by
      #2

      The result is not used for PostMessage()'s, but it is when using SendMessage(). The return value is completely up to you. I usually just return 0, if its not important. I have come across a few messages that are used in this way to indicate success or failure.


      I Dream of Absolute Zero

      C 1 Reply Last reply
      0
      • R RChin

        The result is not used for PostMessage()'s, but it is when using SendMessage(). The return value is completely up to you. I usually just return 0, if its not important. I have come across a few messages that are used in this way to indicate success or failure.


        I Dream of Absolute Zero

        C Offline
        C Offline
        Cliff Hatch
        wrote on last edited by
        #3

        Thanks for your reply. It makes perfect sense now. :) Best Regards Cliff

        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