0

I'm using this code to add a global shortcut to my C# console program: https://stackoverflow.com/a/3654821/170931

It works fine with hotkeys like Ctrl+F6. However, I don't know how to use only F6 as its hotkey. When I use:

HotKeyManager.RegisterHotKey(Keys.F6);

I got the error:

Severity Code Description Project File Line Suppression State Error CS7036 There is no argument given that corresponds to the required formal parameter 'modifiers' of 'HotKeyManager.RegisterHotKey(Keys, KeyModifiers)' CALD C:...\Program.cs 425 Active

Is it possible to use only F6 as the hotkey?

Just a learner
  • 26,690
  • 50
  • 155
  • 234
  • The method takes two arguments. The KeyModifiers enum needs to have None = 0 added to make you happy. Beware that you are not actually going to be happy, you'll make any other program that uses F6 malfunction. Like VS, etc. – Hans Passant May 11 '19 at 08:40
  • Can you use `default(KeyModifiers)` as an argument for the `RegisterHotKey()` method? – Progman May 11 '19 at 09:21

0 Answers0