do messages sent to HWND_BROADCAST go to other desktops?
Question
I'm trying to determine some of the details of how HWND_BROADCAST
works. Unfortunately, MSDN doesn't have a specific page for this value; it's only mentioned in passing in several other articles, such as the ones for SendMessage
and PostMessage
.
What I specifically want to know is whether messages sent to HWND_BROADCAST
are received by windows associated with other desktops in the same window station. The docs say the message will go to "all top-level windows in the system", but clearly that can't be strictly true. For instance, I'm sure they wouldn't go to windows in other logon sessions (e.g. on a terminal server). My guess is that they are at least limited to the window station of the calling process, but I don't know if they are also limited to the desktop of the calling thread (each thread is associated with a single desktop).
Worst case I can go write some code to test this empirically, but does anybody happen to know the answer already?
Solution
You are correct. Messages sent in this manner will only go to the top-level windows of the currently logged in windows session/desktop. They will not go to any other desktop.
OTHER TIPS
Vista will block the message to be delivered to top-level windows if it comes from a lower privileged process, you should care of it.