I am using Registerhotkey to allow my users to define custom key combinations to perform different actions. The problem I seem to be having is that there is currently no way to check if the key already exists.
For example: One of my testers tried to define "Windows Key + D" not knowing that is the key combination to minimize all windows. So I was curious if there was any way to tell if given a key combination that I could check if that key combination already exists by windows or any other application.
Thanks to @jim-mischel for helping me find this solution!
To check if a hot key exists simply do the following:
int ShortcutID = 100; // ID used for this Shortcut Key Combination
uint keyModifier = 2; // This is the Control Key
Char alphanumericKey = "C";
bool didItError
= RegisterHotKey(this.Handle, ShortcutID, keyModifier, (int)alphanumericKey );
Since Control+C is a registered key combination by windows the RegisterHotKey will return false, if it was not a registered key combination it would return true!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With