-3

Hey looking to assign F1 as a hotkey to run a function. I have a windows 32 project with a Form, however the form will be in the background and not the active window when I press F1.

Is there a way to code a hotkey or shortcut so when I press F1 it will run that function even if the Form1 isn't active?

Morteza Asadi
  • 1,819
  • 2
  • 22
  • 39
Brandy
  • 544
  • 2
  • 11
  • 30

1 Answers1

3

Have a look at the RegisterHotKey function.

It allows you to define a system-wide hot key. When the hot key is pressed, you will receive a WM_HOTKEY message even if your window is not active.

zett42
  • 25,437
  • 3
  • 35
  • 72