keyboard-hook

C# very simple keyboard hook

纵饮孤独 提交于 2021-02-08 11:47:43
问题 im trying to create a custom macro program in C# and I want to know how I can create a low level keyboard hook. I have looked around and have found some but i do not understand how they work or how i can customise it :/ can anyone show me how I can create a keyboard hook that basically does: once any key is pressed, the int keycode is set to a method (i think the VK code is what i need?) the exampels i find online seem too complicated for that :/ Thanks :) 回答1: A Simple C# Global Low Level

LowLevelKeyboardProc() never is executed

回眸只為那壹抹淺笑 提交于 2021-02-08 10:40:37
问题 I'm need hook my keyboard and found the following code (reference here) that i want use in a Delphi Console project. Happens that after the first test i noted that LowLevelKeyboardProc() function never is executed ( hello never is displayed on console window). Already SetWindowsHookEx() is working fine and returning <> 0. Then someone can help me to solve this problem please? program Project1; {$APPTYPE CONSOLE} {$R *.res} uses Windows, Messages, SysUtils; function ToUnicodeEx(wVirtKey,

Record Key Press From Outside The Application (VB.net) [duplicate]

旧城冷巷雨未停 提交于 2020-12-26 05:05:26
问题 This question already has answers here : How to listen keyboard in background and fire keystrokes on demand? (2 answers) Closed 4 years ago . I am making a program which uses the function of a keylogger to determine trends, the problem is I can't make the keylogger, I have most of it complete but I can't get key presses when the form is out of focus... I have seen people mentioning keyboard and message hooks, but I can't find any examples or understand any documents on it. Private Sub Form1

When I swap keys using SetWindowsHookEx WH_KEYBOARD_LL, why does my program get into a cycle of too many keyboard input events?

让人想犯罪 __ 提交于 2020-08-22 06:41:31
问题 I am trying to write a program for Windows system that swaps the A and B keys, i.e. when I press the A key, B gets typed, and vice versa. To do so, I first map the A key to behave like the B key. Here is the code I wrote. #include <stdio.h> #include <windows.h> HHOOK hook; LRESULT CALLBACK keyboardHook(int nCode, WPARAM wParam, LPARAM lParam) { KBDLLHOOKSTRUCT *p = (KBDLLHOOKSTRUCT *) lParam; DWORD newVkCode; INPUT inputs[1]; UINT ret; char wParamStr[16]; char vkStr[16] = ""; if (wParam == WM

Keyboard hook stops working after using Remote desktop

自古美人都是妖i 提交于 2020-02-21 06:07:33
问题 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()

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

给你一囗甜甜゛ 提交于 2020-02-02 02:37:12
问题 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

Keyboard hook changes the behavior of keys

雨燕双飞 提交于 2020-01-23 08:20:27
问题 I'm creating a program that installs a keyboard hook to capture all keys and display some text related to them. However, I've hit upon a snag, and that is some keys change behavior when the hook is installed. I'll see about posting a small, but complete, test program, but for now I'll just describe the problem. The problem exhibits itself on Windows 7 64-bit, in .NET 4.0, a C# program. I assume none of this matters. My hook installs itself via SetWindowsHookEx and then handles all keys

Keyboard hook changes the behavior of keys

烈酒焚心 提交于 2020-01-23 08:18:34
问题 I'm creating a program that installs a keyboard hook to capture all keys and display some text related to them. However, I've hit upon a snag, and that is some keys change behavior when the hook is installed. I'll see about posting a small, but complete, test program, but for now I'll just describe the problem. The problem exhibits itself on Windows 7 64-bit, in .NET 4.0, a C# program. I assume none of this matters. My hook installs itself via SetWindowsHookEx and then handles all keys

Global keyboard hook

倾然丶 夕夏残阳落幕 提交于 2020-01-17 08:43:43
问题 I need to capture global keyboard messages, so I use SetWindowsHookEx() with WH_KEYBOARD_LL. But it only works when application is in focus and does not trigger Callback globally. Almost the same code works great with mouse_LL(with another structure& etc.) Please help! public const int WH_KEYBOARD_LL = 13; public const int VK_INSERT = 0x2D; public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam); HookProc KeyboardHookProcedure; [DllImport("user32.dll", CharSet = CharSet.Auto,

Keyboard hook fires multiple times in MS Word

让人想犯罪 __ 提交于 2020-01-05 04:28:16
问题 This is in reference to a question asked in Detecting text changes in Word 2016 from VSTO add-in While the answer provided by Dirk Vollmar works, I noticed that hitting one key triggers KeyboardHookCallBack 10-12 times and I am not able to capture accurately the sequence the keys are being hit in. Pardon me if my question is stupid but is there a way to make sure that the KeyboardHookCallBack is triggered only once for each key? I have been trying this for some time now without any luck. I'd