keyboard-hook

Capturing a key without focusing the window

一笑奈何 提交于 2019-12-05 09:58:52
I have a application that always checks if a key like F12 is pressed. It doesn't need to have in focus of my main window of my app. I tried this code: public int a = 1; // DLL libraries used to manage hotkeys [DllImport("user32.dll")] public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc); [DllImport("user32.dll")] public static extern bool UnregisterHotKey(IntPtr hWnd, int id); const int MYACTION_HOTKEY_ID = 1; public Form1() { InitializeComponent(); // Modifier keys codes: Alt = 1, Ctrl = 2, Shift = 4, Win = 8 // Compute the addition of each combination of

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

别等时光非礼了梦想. 提交于 2019-12-05 06:46:10
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 AutoHotkey , which worked pretty well under Windows XP. However, on Vista and Windows 7, Cmd + L causes problems: Regardless of low-level keyboard hooks, Win + L is always intercepted by Windows and normally locks the workstation... You can disable workstation

Can I change a user's keyboard input?

戏子无情 提交于 2019-12-05 03:17:54
问题 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: private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN) { //The truely typed character:

How to hook Win + Tab using LowLevelKeyboardHook

左心房为你撑大大i 提交于 2019-12-05 01:47:51
In a few words: blocking Win up after Win + Tab makes Windows think Win is still down, so then pressing S with the Win key up for example will open the search charm rather than just type "s"... until the user presses Win again. Not blocking it means the Windows Start menu will show up. I'm in a conundrum! I have no trouble hooking into shortcuts using Alt + Tab using LowLevelKeyboardHook , or Win + Some Ubounded Key using RegisterHotKey . The problem happens only with the Win key using LowLevelKeyboardHook . In the example below, I'm taking over the Win up event when the Win + Tab combination

Keyboard hook stops working after using Remote desktop

那年仲夏 提交于 2019-12-04 20:07:44
I've the following problem: My global keyboard hook stops working after i start any Remote Desktop session, even if session is closed hook doesn't work at all. Here is code of my hook public class KeyboardHooker : IDisposable { private IntPtr _hhook; private static User32.LowLevelKeyboardProc _delegate; public KeyboardHooker() { _delegate = new User32.LowLevelKeyboardProc(HookCallback); } public void SetHook() { if (IsHookSetted) return; using (Process curProcess = Process.GetCurrentProcess()) using (ProcessModule curModule = curProcess.MainModule) { _hhook = User32.SetWindowsHookEx(User32.WH

Is it possible to use Win32 Hooks in Qt applications

跟風遠走 提交于 2019-12-04 11:31:59
问题 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 created a win32 dll using vc++ express edition and placed my hook commands inside the dll functions. And I call that dll functions from Qt using QLibrary class /*

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

纵然是瞬间 提交于 2019-12-04 11:11:51
问题 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 former? 回答1: I ran across a few solutions to this problem today and figured I'd circle back around and share here so others could save the search time. A nifty cross platform solution for simulating keyboard and mouse input: http://www.autopy.org/ I

How to know if the keyboard is active on a text input

你说的曾经没有我的故事 提交于 2019-12-04 05:29:15
问题 I have an application that acts like an on screen keyboard, I need it to know if there is a keyboard cursor (caret) active any where, so the keyboard will set to active. I have searched for keyboard hooks and winapi, but I couldn't find the proper method to use. To simplify my problem, I need my application to be active if the user can press on the real keyboard and print text on the computer. 回答1: It is easy by searching for the caret position, since it should be larger than 0 GUITHREADINFO

Can you remap keys of a specific keyboard?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 04:53:21
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 to the "Media Play" key, but if the same "5" was pressed on the keypad of the full keyboard, I'd get a "5". In essence, I want to turn that seperate numeric keypad into a media control device. Unfortunately I'm not sure how to make this work. There is a "Raw Input" feature of Windows which allows to distinguish between keyboards, but that only

C# Mono - Low Level Keyboard Hook

Deadly 提交于 2019-12-04 03:58:23
问题 I'm using code that I found on the CodeProject.com for a low-level keyboard hook. The only problem is it uses external DLL calls that don't work in mono. I was wondering if anyone knew of a way to accomplish the same thing as that code, but will run in both Windows using .net, and Linux using mono? Edit: Clarifying what I'm trying to do: I'm making a Dashboard like application. The program sits in the system tray and when the user presses the hot-key, it will pop up all the gadgets. So the