Closed adem404 closed 2 years ago
Hi. It is possible to register a hotkey for such media buttons but the reason why it doesn't work is that we are using UIElement.ProcessKeyboardAccelerators
to detect the initial combination before actually registering it and this event is not called for those buttons and probably a few others. My guess is that it doesn't consider them as valid accelerators
or keyboard shortcuts
.
Manually detecting this odd combination using events like UIElement.KeyDown
is certainly possible but this is more error-prone than what we've got.
Perhaps the bigger issue I see is that registering a hotkey with such a combination won't stop other applications such as Spotify from handling these media buttons and the outcome isn't pretty: you will change the audio device, but also your current song.
I forgot about the Spotify integration of the media keys maybe because i dont use them. Some years ago i used this application back then i think the media keys got registred as input. But time pass and api changes. Thx for the reply.
No problem. Do note that currently, it's not even possible to disable the media keys in Spotify (https://community.spotify.com/t5/Desktop-Windows/How-to-disable-Hardware-Media-Key/td-p/4966916) so I'm gonna this issue for now.
Is it possible to listen to media buttons? Here are the Virtual-Key Codes, if it helps:
VK_MEDIA_NEXT_TRACK | 0xB0 | Next Track key -- | -- | -- VK_MEDIA_PREV_TRACK | 0xB1 | Previous Track keyhttps://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes