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