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. Win32 SDK ::RegisterWindowMessage

Win32 SDK ::RegisterWindowMessage

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.
  • B Offline
    B Offline
    berndg
    wrote on last edited by
    #1

    I register my user messages with ::RegisterWindowMessage(). I fail to identify a technique to deregister such a message - will it automatically be free'ed when the application goes, am I blind and fail to see the appropriate function in MSDN, or is Windows running out of user message codes eventually? Mind you the OS is likely to die on me before this happens, but the question remains... Any clues? TIA, Bernd

    G 1 Reply Last reply
    0
    • B berndg

      I register my user messages with ::RegisterWindowMessage(). I fail to identify a technique to deregister such a message - will it automatically be free'ed when the application goes, am I blind and fail to see the appropriate function in MSDN, or is Windows running out of user message codes eventually? Mind you the OS is likely to die on me before this happens, but the question remains... Any clues? TIA, Bernd

      G Offline
      G Offline
      GeMe_Hendrix
      wrote on last edited by
      #2

      You should only use RegisterWindowMessage() to send messages to another application running in a different process. For internal window message communication you shouldn't really use this. But don't worry if you do when your application shuts down (providing another application hasn't registered the same message) the operating system will gradually release its mapped resource on this string. If you are just doing this from within your own application have a look at ON_MESSAGE in MSDN. This is the correct way to deal with custom messages from within your application (unless of course you want to pass messages between GUI threads which would use ON_THREAD_MESSAGE)

      B 1 Reply Last reply
      0
      • G GeMe_Hendrix

        You should only use RegisterWindowMessage() to send messages to another application running in a different process. For internal window message communication you shouldn't really use this. But don't worry if you do when your application shuts down (providing another application hasn't registered the same message) the operating system will gradually release its mapped resource on this string. If you are just doing this from within your own application have a look at ON_MESSAGE in MSDN. This is the correct way to deal with custom messages from within your application (unless of course you want to pass messages between GUI threads which would use ON_THREAD_MESSAGE)

        B Offline
        B Offline
        berndg
        wrote on last edited by
        #3

        Thanks for the clarification on the resource management issue. I wonder, though: why is it that I shouldn't use this for inter-thread communication (not GUI threads, but regular workers) within a process? TIA, Bernd

        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