keyboard-hook

Using a low-level keyboard hook to change keyboard characters.

Hi all, I'm creating a custom keyboard layout. As the beginning step, I want to have the user press a key, have my keyboard hook intercept it, and output a different key of my choosing. I found this keyboard hook code, which I'm trying to slightly modify for my purposes: http://blogs.msdn.com/toub/archive/2006/05/03/589423.aspx I've c...

Can I change a user's keyboard input?

I found this keyboard hook code, which I'm trying to slightly modify for my purposes: http://blogs.msdn.com/toub/archive/2006/05/03/589423.aspx As an overview, I want to have the user press a key, say 'E', and have the keyboard return a different character, 'Z', to whatever app is in focus. The relevant method I changed now looks like:...

Help getting the 'Windows Input Simulator' C# interface working

This looks perfect for what I'm trying to do. I need to stop mucking around with SendInput() and let someone else do it for me! http://inputsimulator.codeplex.com/ The problem is there's no documentation for getting the code working as simply as it does on the home page there. Can someone help me with the 'other code' I need to have in...

Global Keyboard hook not working.

I have created a global Keyboard hook. Hook is created in a DLL. #pragma comment(linker, "/SECTION:.SHARED,RWS") #pragma data_seg(".SHARED") static HHOOK hkb=NULL; static CMyFile *pLF; #pragma data_seg() HINSTANCE hins = NULL; extern "C" LRESULT __declspec(dllexport) __stdcall CALLBACK KeyBoardHookProc( int nCode, WPARAM w...

High level global keyboard hook for C# and WPF for reading a keyboard wedge card scanner

The only keyboard hook supported for .NET managed code is a low-level keyboard hook (WH_KEYBOARD_LL). See http://stackoverflow.com/questions/1639331/using-global-keyboard-hook-whkeyboardll-in-wpf-c I have the above code working in my application at the moment so that when you swipe your card you will get a list of all the keystrokes. ...

Is it possible to use Win32 Hooks in Qt applications.

I like to know if its possible to use win32 keyboard hook function (SetWindowsHookEx , SetWindowsHookEx ) in a Qt application. If possible pls provide a sample code on using SetWindowsHookEx , SetWindowsHookEx functions in Qt. //Update as of 18 Feb 2010 // I havent figured out how to do that in QT yet. But as a workaround I have cre...

How to get keyboard input while running in vmware virtual machine?

Hi everybody! I'm logged into a virtual machine using vmware workstation 6.5-7.0.1 or vmware player 3.0.0. I'm working inside the virtual machine. Then I press a key (for example the Delete-Key, but it should work with every key) inside the virtual machine. I want to recognize the "key-press-event" in my C# application which is runni...

Suppress task switch keys (winkey, alt-tab, alt-esc, ctrl-esc) using low-level keyboard hook

I'm trying to suppress task switch keys (such as winkey, alt-tab, alt-esc, ctrl-esc, etc.) by using a low-level keyboard hook. I'm using the following LowLevelKeyboardProc callback: IntPtr HookCallback(int nCode, IntPtr wParam, ref KBDLLHOOKSTRUCT lParam) { if (nCode >= 0) { bool suppress = false; // S...

Problem with Keyboard hook proc

The background: My form has a TWebBrowser. I want to close the form with ESC but the TWebBrowser eats the keystrokes - so I decided to go with a keyboard hook. The problem is that the Form can be open in multiple instances at the same time. No matter what I do, in some situations, if there are two instances open of my form, closing one...

Is it possible to poll GetKeyboardState() as a replacement for a global keyboard hook?

Is it possible to poll GetKeyboardState() as a replacement for a global keyboard hook? ...

Anything wrong with spamming GC.KeepAlive(KeyboardHookPointer)?

GC.KeepAlive() References the specified object, which makes it ineligible for garbage collection from the start of the current routine to the point where this method is called. Not really sure about what GC.KeepAlive does other than simply store a reference so the Garbage Collector doesn't collect the object. But does calling G...

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 false. (Also verified that it returns true when it was working properly) There doesn't seem ...

WinForms: How to prevent textbox from handling alt key and losing focus?

I have this textbox I use to capture keyboard shortcuts for a preferences config. I use a low-level keyboard hook to capture keys and also prevent them from taking action, e.g. the Windows key, but the Alt key still comes through and makes my textbox lose focus. How can I block the Alt key, so the focus is kept unaltered at my textbox? ...

Generating Mouse-Keyboard combination events in python

I want to be able to do a combination of keypresses and mouseclicks simultaneously, as in for example Control+LeftClick At the moment I am able to do Control and then a left click with the following code: import win32com, win32api, win32con def CopyBox( x, y): time.sleep(.2) wsh = win32com.client.Dispatch("WScript.Shell") w...

How can I do something ~after~ an event has fired in C#?

I'm using the following project to handle global keyboard and mouse hooking in my C# application. This project is basically a wrapper around the Win API call SetWindowsHookEx using either the WH_MOUSE_LL or WH_KEYBOARD_LL constants. It also manages certain state and generally makes this kind of hooking pretty pain free. I'm using th...

Capturing Ctrl+Shift+Esc Before Task Manager Does

I'm using the Windows API (SetWindowsHookEx) to capture keyboard events. I would like to pass the Ctrl+Shift+Esc combination to my application for processing but suppress Task Manager appearing. Unfortunately, it looks like the three key combination never gets as far as my Keyboard Hook routine; I only ever get two keys. I don't want ...

How do you implement global keyboard hooks in Mac OS X?

I know this can be done for Windows and that XGrabKey can be used for X11, but what about Mac OS X? I want create a class that allows setting shortcut keys that can be invoked even when the application windows are inactive. ...

Low-level Keyboard Hooks/SendInput with Winkey+L possible? (workstation lockout is intercepted in Vista and higher)

I work on a project called UAWKS (Unofficial Apple Wireless Keyboard Support) that helps Windows users use Apple's bluetooth keyboard. One of the main goals of UAWKS is to swap the Cmd key (which behaves as Winkey in Windows) with Ctrl, allowing users to do Cmd+C for copy, Cmd+T for new tab, etc. It is currently developed using AutoHotk...

Intercept keystrokes to a window

Is it possible to intercept a keystroke (and characters) sent to a window? By intercept, I mean play man-in-the-middle, instead of having just hooks onto the Window. I'd like to filter (i.e. eliminate some keystrokes) keystrokes to a window. ...

JNA Keyboard Hook in Windows

Hello, 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. However, the callback never get called when I press any key on the keyboard. Here is m...