3

I need a way in C# to monitor system-wide keys such as Ctrl+A, so I can act upon that.

How could I get such an event, even when the keys were pressed with my App no longer in focus?

Patrick McDonald
  • 62,076
  • 14
  • 100
  • 117
Robin Rodricks
  • 105,357
  • 137
  • 385
  • 594

2 Answers2

4

You can use the RegisterHotKey function to react system-wide to hotkeys. However, I wouldn't advise you to use something like Ctrl + A which has a meaning in many applications.

Jasper
  • 2,136
  • 3
  • 32
  • 49
Joey
  • 330,812
  • 81
  • 665
  • 668
-1

I don't think there's a managed way to do that. At an API level you can register system-wide hooks or global hotkeys.

Writing a keylogger? :-)

marklam
  • 5,266
  • 1
  • 23
  • 26