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. Posting too many messages

Posting too many messages

Scheduled Pinned Locked Moved C / C++ / MFC
cssquestionlearning
2 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
    Russell
    wrote on last edited by
    #1

    I'm sending (PostMessage) from a worker-thread to the main thread a custom message to do some refresh. What happens is that it looks that a big amount of messages are in some cases accumulated into the list of message. I don't want to reduce the rate of messages sent. Is there a simple way when posting [worker-thread] a new message to remove older (obsolete) message (of course the same message type) and leave there only the new one? Or it is possible to tell to the main thread to avoid to process a message if there is in the list the some copy less old than the current one?


    Russell

    _ 1 Reply Last reply
    0
    • R Russell

      I'm sending (PostMessage) from a worker-thread to the main thread a custom message to do some refresh. What happens is that it looks that a big amount of messages are in some cases accumulated into the list of message. I don't want to reduce the rate of messages sent. Is there a simple way when posting [worker-thread] a new message to remove older (obsolete) message (of course the same message type) and leave there only the new one? Or it is possible to tell to the main thread to avoid to process a message if there is in the list the some copy less old than the current one?


      Russell

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      You can use SendMessageCallback[^] instead of PostMessage. This API return immediately just like PostMessage. When the message handler is finished with processing the message the callback function passed in as parameter to SendMessageCallback is called. This way you can keep track of whether a specific message handler has finished processing the message.

      «_Superman_» I love work. It gives me something to do between weekends.

      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