Questions tagged [keyhook]

Changing listening or reacting to events related to specific keys of the keyboard or other devices.

A key hook is a feature that allows to replace or extend the standard behavior of specific keys of the keyboard or other devices, in a systematic way.

The hook may work at a low level, by replacing some system routines at operating system level or in the keyboard driver. It is different from a simple event listener, in that the hooks behavior is not specific for a software feature, but is general to the whole application or event to the whole system.

Related tags

  • Use tag for hooking other event drivers than those of the keyboard.

See also

34 questions
5
votes
1 answer

Global keyhook for mediakeys in C#

With the following RegisterHotKey function, I can globally hook normal key-modifier combinations: [DllImport("user32.dll")] private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk); Great article about it and full…
darx
  • 1,417
  • 1
  • 11
  • 25
3
votes
1 answer

Using jna to keyhook and consume

I'm making an auto clicker that uses jna to hook global input from the keyboard and mouse. For the keyboard hook im using http://code.google.com/p/goldriver/source/browse/trunk/king/src/jnacontrib/w32keyhook/KeyHook.java?r=36. I was wondering if…
Michael Rentmeister
  • 167
  • 1
  • 6
  • 24
3
votes
1 answer

SendKeys alternatives?

I created a keypad app that stays on top, but does not take the focus so that on a touch screen it will forward whatever keys you press to the active application via SendKeys. It works perfectly with every application I have tried it with... except,…
BVernon
  • 3,205
  • 5
  • 28
  • 64
2
votes
1 answer

Low-level keyboard hook does not detect keystrokes VB.NET

I've been successfully practising low-level keyboard hooks in Visual Basic 2010 (.NET Framework v4.0), then moved the same hook project to Visual Studio 2017 (.NET Framework 4.5.2) and now it does not detect any keystrokes. I've already tried…
blondkarol
  • 41
  • 9
2
votes
1 answer

C# keyhook question

I copied the following code from http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx, public int hookProc(int code, int wParam, ref keyboardHookStruct lParam) { if (code >= 0) { Keys key = (Keys)lParam.vkCode; if…
user397232
  • 1,750
  • 6
  • 21
  • 30
2
votes
2 answers

How to set HotKey system-wide in C#

In AutoIt v3 there's a function called HotKeySet. It sets a hotkey that calls a user function when pressed. It's a system wide hotkey, meaning that the key can't be used for anything else when the hotkey is set. Basically, I would like to catch Esc…
MadBoy
  • 10,824
  • 24
  • 95
  • 156
2
votes
1 answer

Global Keyhook in C#

I want to make a new Application which I can control via keys from outside GUI. If the key was pressed there should be a text field changing at first. At last I want to make a timer start on keyPress. I googled and visit Stack Overflow but found…
Gero K
  • 61
  • 1
  • 11
2
votes
2 answers

Global Keyhook on 64-Bit Windows

I currently have some trouble to get a global keyhook working on a Windows 7 64-Bit O/S. Now I know that there are a lot of threads on this topic already here on Stackoverflow, but none of them quite give me an answer that I can work with or I don't…
PuerNoctis
  • 1,364
  • 1
  • 15
  • 34
1
vote
3 answers

How can I intercept and block the caps lock toggle event globally, leaving other events intact?

I need to check the toggled state of caps lock and block it. I have tried using a low-level keyboard hook SetWindowsHookEx with WH_KEYBOARD_LL and checking for WPARAM==WM_KEYDOWN || WPARAM==WM_SYSKEYDOWN messages, and LPARAM.vkCode==VK_CAPITAL ||…
NS studios
  • 149
  • 14
1
vote
0 answers

How do I run a background worker on an infinite loop

I am developing a plugin for an application. I need to implement a low-level keyhook to capture keys. I have tried running the keyhook on the same thread as the main application + plugin, but it's performance is hit and miss. I'm not able to query…
stigzler
  • 793
  • 2
  • 12
  • 29
1
vote
1 answer

Win32 keyboardHook Callback receiving VK_LCTRL event whenever the top window is changed

I am using the Windows API on Windows7 with Visual Studio 2019. I'm trying to set a low level keyboard hook and read the key input to the console, to do so I use the function: HHOOK SetWindowsHookExA( [in] int idHook, [in] HOOKPROC lpfn, [in]…
Dissoantn Void
  • 145
  • 1
  • 3
  • 9
1
vote
2 answers

Holding Alt Button Using Windows Messages

How can I, with windows messages, Hold the ALT button? Is there a WM_KEYHOLD or anything like that? This is the code to screen shot but I guess something is missin. I think the key codes im using are bad, For 0x70 it sends F1. and for 0x46 it sends…
user779444
  • 1,365
  • 4
  • 21
  • 38
1
vote
0 answers

Qt: How receive keyboard events when my application doesn't have focus in Qt5 specifically?

I have the exact same problem of this post: I want to make a software which, once executed, will monitor for a specific key event (press of F12) and will do something (do repeated mouse clicks: an auto clicker). But I'ld like, if possible, to use Qt…
Momergil
  • 2,213
  • 5
  • 29
  • 59
1
vote
0 answers

How can I profile my Java application to find performance bottlenecks?

This application (.jar file) takes a screenshot using robot class, takes the file name from user which is a URL into a JFrame input box. Truncates and removes all illegal characters from it and saves it using a save as dialog box with time-stamp as…
Scitech
  • 513
  • 1
  • 5
  • 16
1
vote
1 answer

Java JNA- Jar application hangs in 32 bit windows system

Here's a screenshot application. Compiled with 1.8 JDK, works perfectly well in 64 bit systems, but lags and hangs in two iterations in 32 bit systems. Basically this application takes a screenshot using robot class, takes the file name from user…
Scitech
  • 513
  • 1
  • 5
  • 16
1
2 3