Questions tagged [keyboard-hook]

The term keyboard hook covers a range of techniques used to alter or augment the behavior or intercepting keyboard event messages before they reach an application.

The term keyboard hook covers a range of techniques used to alter or augment the behavior or intercepting keyboard event messages before they reach an application.

313 questions
104
votes
7 answers

Global keyboard capture in C# application

I want to capture a keyboard shortcut in my application and trigger a dialog to appear if the user presses a keyboard combo even outside of the app. Similar to Google Desktop Search's Ctrl, Ctrl to bring up the search dialog. I have tried using some…
Jeremy Edwards
  • 14,620
  • 17
  • 74
  • 99
25
votes
7 answers

What can cause Windows to unhook a low level (global) keyboard hook?

We have some global keyboard hooks installed via SetWindowsHookEx with WH_KEYBOARD_LL that appear to randomly get unhooked by Windows. We verified that they hook was no longer attached because calling UnhookWindowsHookEx on the handle returns…
Davy8
  • 30,868
  • 25
  • 115
  • 173
24
votes
3 answers

Modify NSEvent to send a different key than the one that was pressed

I'm trying to create an OS X keyboard hook for assistive technology purposes (i.e. don't worry, not a keylogger). When a user presses a key, I want to prevent the real keypress and send a fake keypress (character of my choosing) instead. I have the…
ck_
  • 3,719
  • 10
  • 49
  • 76
23
votes
5 answers

C# - Why won't a fullscreen winform app ALWAYS cover the taskbar?

I'm using Windows Vista and C#.net 3.5, but I had my friend run the program on XP and has the same problem. So I have a C# program that I have running in the background with an icon in the SystemTray. I have a low level keyboard hook so when I…
Joel
  • 16,474
  • 17
  • 72
  • 93
19
votes
9 answers

ToAscii/ToUnicode in a keyboard hook destroys dead keys

It seems that if you call ToAscii() or ToUnicode() while in a global WH_KEYBOARD_LL hook, and a dead-key is pressed, it will be 'destroyed'. For example, say you've configured your input language in Windows as Spanish, and you want to type an…
00010000
  • 323
  • 1
  • 4
  • 13
17
votes
4 answers

How can my app find the sender of a windows message?

I have an app which uses a keyboard hook procedure in a library. The wParam in the hook for one message is 255 which we think is "(reserved / OEMClear)". I'd like to work out the source of this message as it causes my application to crash in the…
mj2008
  • 6,647
  • 2
  • 38
  • 56
16
votes
2 answers

JNA Keyboard Hook in Windows

I have put together a JNA code for installing keyboard hook in Windows (using the JNA examples). The code compiles and everything, and I get the hook installed (I get handle to the hook successfully), also I can uninstall the hook successfully.…
temp
  • 485
  • 2
  • 5
  • 7
15
votes
3 answers

Intercepting the Fn key on laptops

Sometimes when I work on Thinkpads/MSI laptops, the Ctrl and Fn key are swapped (Fn being the leftmost key), and it drives me nuts - I keep hitting Fn instead of Ctrl. I was wondering if it's at all possible to intercept the Fn key. I'd like to…
Igal Tabachnik
  • 31,174
  • 15
  • 92
  • 157
14
votes
3 answers

Global keyboard hook with WH_KEYBOARD_LL and keybd_event (windows)

I am trying to write a simple global keyboard hook program to redirect some keys. For example, when the program is executed, I press 'a' on the keyboard, the program can disable it and simulate a 'b' click. I do not need a graphic ui, just a…
user1722361
  • 377
  • 1
  • 4
  • 14
14
votes
4 answers

Listening to keyboard events without consuming them in X11 - Keyboard hooking

I tried to write a program which hooks keyboard messages to pronounce the name of each key whenever it is pressed in Ubuntu (KDE); without interfering with normal action of keyboard in programs (just announcing the key name). This is my…
Minimus Heximus
  • 2,683
  • 3
  • 25
  • 50
14
votes
4 answers

Monitoring keyboard activity in C# while my application is in the background

First of all I need to make it clear that I have no interest in keylogging. I need a way to monitor keyboard activity at the most basic level while my application is in the background. I don't need to know which keys, I don't need to save any data,…
Tane Lattanzio
  • 143
  • 1
  • 1
  • 6
13
votes
5 answers

Can I use Python to capture keyboard and mouse events in OSX?

I'm trying to write a simple macro recorder in Python for OSX - something which can capture mouse and key events as the script runs in the background and replay them. I can use autopy for the latter, is there a similarly simple library for the…
Andrey Fedorov
  • 9,148
  • 20
  • 67
  • 99
13
votes
2 answers

Can you remap keys of a specific keyboard?

I've got two keyboards attached to my computer. A normal full-size keyboard and a numeric keypad. I want to "remap" the keys on the numeric keypad, but leave the full keyboard alone. So, when the user presses "5" on the keypad it would get remapped…
Vilx-
  • 104,512
  • 87
  • 279
  • 422
11
votes
5 answers

Is it possible to detect when a low-level keyboard hook has been automatically disconnected by Windows?

I am working on a program that uses keyboard hooks. However, when the PC that the program is running on is just slightly overloaded, it causes Windows to disconnect the hook from the program, causing it to no longer respond to keystrokes. Is there a…
Mathias Lykkegaard Lorenzen
  • 15,031
  • 23
  • 100
  • 187
11
votes
4 answers

SetWindowsHookEx returns 0 when compiling for the .NET 4.0 framework in 32bit machines

I'm trying to set a low level windows keyboard hook to grab three keys pressed even if the application is not in focus. To do this I'm calling SetWindowsHookEx as // Create an instance of HookProc. KeyboardHookProcedure = new…
eblacklight
  • 183
  • 1
  • 1
  • 7
1
2 3
20 21