keyboard-hook

How to hook external process with SetWindowsHookEx and WH_KEYBOARD

我的未来我决定 提交于 2019-11-27 08:30:59
I am trying to hook for example Notepad without sucess. Making a global hook seems to work fine. Testing on XP SP2. Edit: Amended code works now. MyDLL code #include <windows.h> #include <iostream> #include <stdio.h> HINSTANCE hinst; #pragma data_seg(".shared") HHOOK hhk; #pragma data_seg() //#pragma comment(linker, "/SECTION:.shared,RWS") compiler error in VC++ 2008 express LRESULT CALLBACK wireKeyboardProc(int code, WPARAM wParam,LPARAM lParam) { if (code < 0) { return CallNextHookEx(0, code, wParam, lParam); } Beep(1000, 20); return CallNextHookEx(hhk, code, wParam, lParam); } extern "C" _

Intercepting the Fn key on laptops

我的梦境 提交于 2019-11-27 05:49:48
问题 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 write a hook that swaps the Ctrl / Fn keys, but it seems that Fn is not being processed by the OS at all. Any ideas? 回答1: Sorry. As you mentioned, the Fn key isn't processed by the OS, but received as tuples of Fn + [key] . The best you could

How to listen keyboard in background and fire keystrokes on demand?

主宰稳场 提交于 2019-11-27 02:06:53
I want to make a program in vb.NET 2008 which will listen keyboard in background, i.e. even though the application is minimized (globally). If a specific key is been pressed by user, it should keep firing 2 other keys at regular given time intervals until the user presses that specific key again. How can this be done in vb.NET 2008? Source : Here Usage: To create the hook Private WithEvents kbHook As New KeyboardHook Then each event can be handled: Private Sub kbHook_KeyDown(ByVal Key As System.Windows.Forms.Keys) Handles kbHook.KeyDown Debug.WriteLine(Key.ToString) End Sub Private Sub kbHook

Receive OS level key-press events in C# application

强颜欢笑 提交于 2019-11-26 23:15:42
问题 i dont know a better title for the question , but i`ll illustrate my problem. I am working on application that acts like a mp3 player , it uses the Multimedia keys to play/pause , stop the song , i actually made it work but the FormApplication must be in the top [Focused] protected override void WndProc(ref Message msg) { if (msg.Msg == 0x319) // WM_APPCOMMAND message { // extract cmd from LPARAM (as GET_APPCOMMAND_LPARAM macro does) int cmd = (int)((uint)msg.LParam >> 16 & ~0xf000); switch

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

半城伤御伤魂 提交于 2019-11-26 17:35:05
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 following code: - (void) hookTheKeyboard { CGEventMask keyboardMask = CGEventMaskBit(kCGEventKeyDown); id eventHandler = [NSEvent addGlobalMonitorForEventsMatchingMask:keyboardMask handler:^(NSEvent *keyboardEvent) { NSLog(@"keyDown: %c", [[keyboardEvent characters] characterAtIndex:0]); //Want to: Stop the keyboard input //Want to: Send another key

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

天涯浪子 提交于 2019-11-26 17:13:56
问题 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 library, and given it shouldn't be happening it would be good to identify it. The message comes in repeatedly on only one PC we have - other computers don't see the message at all. So, is there a way to trace the source of a message sent to a window

How to hook external process with SetWindowsHookEx and WH_KEYBOARD

╄→гoц情女王★ 提交于 2019-11-26 14:09:35
问题 I am trying to hook for example Notepad without sucess. Making a global hook seems to work fine. Testing on XP SP2. Edit: Amended code works now. MyDLL code #include <windows.h> #include <iostream> #include <stdio.h> HINSTANCE hinst; #pragma data_seg(".shared") HHOOK hhk; #pragma data_seg() //#pragma comment(linker, "/SECTION:.shared,RWS") compiler error in VC++ 2008 express LRESULT CALLBACK wireKeyboardProc(int code, WPARAM wParam,LPARAM lParam) { if (code < 0) { return CallNextHookEx(0,

How to listen keyboard in background and fire keystrokes on demand?

旧街凉风 提交于 2019-11-26 09:57:41
问题 I want to make a program in vb.NET 2008 which will listen keyboard in background, i.e. even though the application is minimized (globally). If a specific key is been pressed by user, it should keep firing 2 other keys at regular given time intervals until the user presses that specific key again. How can this be done in vb.NET 2008? 回答1: Source : Here Usage: To create the hook Private WithEvents kbHook As New KeyboardHook Then each event can be handled: Private Sub kbHook_KeyDown(ByVal Key As

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

梦想与她 提交于 2019-11-26 06:06:48
问题 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 following code: - (void) hookTheKeyboard { CGEventMask keyboardMask = CGEventMaskBit(kCGEventKeyDown); id eventHandler = [NSEvent addGlobalMonitorForEventsMatchingMask:keyboardMask handler:^(NSEvent *keyboardEvent) { NSLog(@\"keyDown: %c\", [

Global keyboard capture in C# application

本秂侑毒 提交于 2019-11-25 21:58:42
问题 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 keyboard hook modules out there that basically use Win32 interop to get this effect but each implementation I\'ve tried ties down the keyboard to some extent to where you start getting weird behaviors when the application is doing something