Capture All Keyboard Input
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 f开发者_Python百科rom the keyboard?
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.
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
精彩评论