0

Another question for today, sorry. My question is how to detect keystrokes on another application or on the desktop. For example, making hotkeys for an app, like a search engine. Or adding a keystrokes display in a video game. Thanks, Bye

  • 1
    Do you want them for a specific application, or just detect keypresses globally? For global, do a search for "low level keyboard hook" and "WH_KEYBOARD_LL". For hotkeys specifically, though, you'd use the RegisterHotKey() API. – Idle_Mind Jun 23 '20 at 15:59
  • Ok, so the API allows me to detect the keystroke anywhere, right? – comicalvery Jun 23 '20 at 16:01
  • The program just displays the keys being clicked. I have tried using the `E.keycode` function but no luck. – comicalvery Jun 23 '20 at 16:16
  • 1
    Anything with `e.keycode` is only going to capture keystrokes while YOUR application is in focus. You need to use either the global hook or the hotkey approach. These are not trivial things. – Idle_Mind Jun 23 '20 at 16:18
  • Here's [an answer](https://stackoverflow.com/a/61177211/5162073) showing how to setup hotkeys. – Brian M Stafford Jun 23 '20 at 17:05

0 Answers0