I am creating Windows application that should perform some action on another application's window when user press defined keyboard shortcut. It works really great, when single user is logged in. I am using WinApi RegisterHotKey to register shortcut and do corresponding action. To perform action on other windows I am using GetForegroundWindow and SendMessage.
During the tests on normal PC everything works great, the problem is on server where users log remotely via remote desktop (in one time there could be up to 10 users working).
When there is more than one user logged in, let say UserA and UserB, UserA is using my application and UserB try to run my application, it throws exception "Cannot register hotkey". It happens because the same keys combination cannot be registered more then once in the system.
I am sure that some other applications can handle global hot keys in multi-user environment, I simply don't have idea how. Could you help me with that?
Only solution that I can see at this moment, is to allow user to define shortcut on application startup and checking if it is available. However, it is totally not user-friendly...