Currently I have a Win32 desktop program written in C++ that uses the Raw HID Input API (a message loop observing WM_INPUT
messages) to read key events and also get a handle to the specific keyboard that produced the event. I need this information to change the behavior depending on the keyboard when I use multiple keyboards.
Now because developing a nice Win32 GUI seems a pain to me, I'd like to use a UWP UI. I tried KeyRoutedEventArgs.DeviceId but this is always an empty string (""
). Maybe this is because it is only supported on Xbox?
The alternative would be to use the Raw Input API again, but the first problem I'm running into then is: can I even obtain window messages from a UWP window? And if so: is it possible to combine this with the Raw Input API to receive WM_INPUT
messages?
To be clear: I don't need the program to be on the Windows Store or anything, I would just like to have a nice UI. But maybe (probably?) this is not possible in this way :/
Something which I just thought of is to try to globally listen for events by using RIDEV_INPUTSINK
when the UWP app window is focused, but this is a mild hack and I hope there is a better and easier way like the DeviceId
property would be.