Using PostMessage Across Desktops
I have a Windows C++ Service. It needs to communicate with any number of VB6 GUI executables that are possibly running on multiple desktops. I use a named pipe to allow the GUI to send messages to the service.
However, I am not using the named pipe to send messages from the service to the GUI. I do not use Named Pipes because you cannot multithread in VB6 (read: multithread reliably and safely), so I wanted to use a communication method that still allowed the GUI to function normally while still monitoring for messages from the service.
The solution I developed was for the service to send messages to the GUI via PostMessage. When the GUI starts, it sends a message to the service via the named pipe. It registers with the server and passes the service its handle. The service then uses PostMessage to send messages to all windows that have registered.
This works fine except in the case of terminal services or fast user switching (which implements terminal services). I log into User1 and start the GUI. I then log into User2 by using "Switch User". Then I trigger a message to be sent from the service to the GUIs. User2's GUI receives the message. However, when I switch back to User1, no message was received.
Does anyone know why this might be happening? Is there any way to fix it?
Thank you for any help you can provide.