I have a string property in settings.setting named "ShortcutKey" which binded to a textbox to get shortcut from user. Also I defined a global hotkey with keyboard hook that every time user press the defined shortcut, my application opens. This is some part of my code which detect specific shortcut is pressed or not but it's not connected to setting, just check Alt+Shift+V:
private void OnHookKeyDown(object sender, HookEventArgs e) { if (e.Alt && e.Shift && e.Key == System.Windows.Forms.Keys.V) { MainWindow.Show(); } }
How can I detect all the combinations shortcut that user may define. for example if ShortcutKey would be: "Alt+V" then I should check for Alt and V pressed, if Shortcutkey would be: Alt+Ctrl+Shift+V+K, should check Alt, Ctrl, Shift and K. how can I modify condition with minimal and concise code to check all possible combination keys.
thanks.