Reputation:
First off, I know this could be used for a keylogger. I'm not going for that, I'm looking to make an application that listens for custom key combinations just to automate a few really annoying tasks.
Is there some way to capture all input from the keyboard?
Upvotes: 8
Views: 17108
Reputation: 613272
You appear to be looking for RegisterHotKey()
.
I don't think you want to hook all keyboard input. You simply want an app with a hidden window listening for WM_HOTKEY
. I don't think you even need to write it yourself. There are a lots of utilities that will do it for you and let you associate system-wide hot keys with actions of your specification, e.g. AutoHotKey.
Upvotes: 4
Reputation: 16266
to capture keyboard input even when your application is not focused, you need to use windows hook, WH_KEYBOARD one. It should be implemented as a DLL to be injected into all processes. Example here
Upvotes: 4