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. Is it possible to give window message different priority ?

Is it possible to give window message different priority ?

Scheduled Pinned Locked Moved C / C++ / MFC
data-structuresquestion
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.
  • G Offline
    G Offline
    GameProfessor
    wrote on last edited by
    #1

    hi all, I wonder if it is possible to give window message different priority, or in other word, one message can interrupt the message queue and is processed before other messages although it arrives in the message queue later. if that's not possible, what's your solution to handle the situations when a window have to process a long message queue, could be > 10 or even 20 messages waiting to be processed.

    R 1 Reply Last reply
    0
    • G GameProfessor

      hi all, I wonder if it is possible to give window message different priority, or in other word, one message can interrupt the message queue and is processed before other messages although it arrives in the message queue later. if that's not possible, what's your solution to handle the situations when a window have to process a long message queue, could be > 10 or even 20 messages waiting to be processed.

      R Offline
      R Offline
      Roger Stoltz
      wrote on last edited by
      #2

      GameProfessor wrote:

      I wonder if it is possible to give window message different priority, or in other word, one message can interrupt the message queue and is processed before other messages although it arrives in the message queue

      Not unless you invent it yourself with a different message queue that you handle yourself. Windows messages can be considered to have three priority levels. Posted messages have the highest priority. This means that they have a higher priority than input messages which are the next priority level. WM_PAINT and WM_TIMER have the lowest priority, in fact they are "pseudo" messages that not even make it to the message queue. The messages are simulated by setting a flag instead and they are processed when the message queue is empty. This also means that even if a timer has expired multiple times before being handled, the message handler for the WM_TIMER message will only be called once.

      GameProfessor wrote:

      if that's not possible, what's your solution to handle the situations when a window have to process a long message queue, could be > 10 or even 20 messages waiting to be processed.

      Depends on the situation, you have to elaborate more on the problem you're trying to solve. I suspect I would use a worker thread reading a queue with application specific contents and not use the windows message queue. The thread would wait for a semaphore that is released when a new object is placed in the queue and process the new object. But this could be a bad solution, it depends on what you're trying to do.


      "It's supposed to be hard, otherwise anybody could do it!" - selfquote
      "High speed never compensates for wrong direction!" - unknown

      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