keyboard-hook

Can I change a user's keyboard input?

血红的双手。 提交于 2019-11-30 03:31:09
问题 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:

Adobe AIR Keyboard Hook

…衆ロ難τιáo~ 提交于 2019-11-30 00:13:43
问题 I'm trying to add a feature to my AIR app that can listen for (configurable) global keyboard events even when the app is minimized. Ex: CTRL-ALT-SHIFT-F12 to grab a screenshot. I can't find any way to register a keyboard hook, and listening for keyboard events only captures them when the app has focus. Suggestions? 回答1: I don't think that Adobe Air programs can process keypress events unless the application is in focus. http://forums.adobe.com/thread/420446 Even this question regarding a

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

时间秒杀一切 提交于 2019-11-29 19:16:50
问题 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 way to prevent this, or even better, propose a different way of solving the exact same problem, by using a different architecture, maybe involving a pipeline? 回答1: You can't "detect" this, and you absolutely shouldn't need to. What you're

global keyboard hooks in c

∥☆過路亽.° 提交于 2019-11-29 15:47:15
问题 i want to write a global keyboard hook to disallow task switching.When i googled i found a whole lot of codes in c#,cpp (and delphi), but i need some basic concepts about hooking (would be the best if examples are in C).So, kindly suggest the resources,links that can help me understand the thing in C's perspective. PS: I found one good working example(works on winXP and older versions),but when i tried compiling the code it gives me: And i tried searching the "IDC_" constants in all the

Global keyboard hook with WH_KEYBOARD_LL and keybd_event (windows)

穿精又带淫゛_ 提交于 2019-11-29 15:10:37
问题 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 console is enough (keep it running) My plan is to use global hook to catch the key input, and then use keybd_event to simulate the keyboard. But I have some problems. The first problem is that the program can correctly block 'A' but if I hit 'A' on the

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

蹲街弑〆低调 提交于 2019-11-29 11:01:57
问题 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 press two keys (Ctr+windows in this case) it'll pull of the application's main form. The form is set to be full screen in the combo key press even handler: this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; So it

How do I trap windows key, alt+tab, ctrl+alt+delete in C#?

懵懂的女人 提交于 2019-11-29 08:04:11
How do I trap Windows key, Alt + Tab , and Ctrl + Alt + Delete in a Windows application using C#? You can capture Ctrl-Alt-Delete. But you need to implement your own GINA dll which is loaded by Winlogon. You'll need to code this up in C or C++ as it needs to be a native DLL. Erich Mirabal As Jan stated, you can't capture CTRL-ALT-DEL without writing your own GINA. For the Windows or ALT-TAB keys, you can look at these for help: Capturing Keystrokes without Focus (SO near-duplicate) How To Set A Windows Hook Hooks (low-level, but will explain what you need for the P/Invoke) Almost by definition

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

送分小仙女□ 提交于 2019-11-29 04:26:51
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 HookProc(KeyboardHookProc); //install hook hKeyboardHook = SetWindowsHookEx( WH_KEYBOARD_LL, KeyboardHookProcedure, Marshal.GetHINSTANCE( Assembly.GetExecutingAssembly().GetModules()[0]), 0); //If SetWindowsHookEx fails. if (hKeyboardHook == 0) { //Returns the error code returned by the last unmanaged function called using platform invoke that has the DllImportAttribute

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

旧巷老猫 提交于 2019-11-29 04:26:05
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 program: #include <X11/Xlib.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <iostream> using namespace std; void SendPressKeyEvent(Display *display, XKeyEvent xkey) { Window current_focus_window; int current_focus_revert; XGetInputFocus(display, &current_focus_window, &current_focus_revert); xkey.type = KeyPress; xkey.display = display;

ToAscii/ToUnicode in a keyboard hook destroys dead keys

☆樱花仙子☆ 提交于 2019-11-28 23:30:24
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 accented letter á in a program. Normally, you'd press the single-quote key (the dead key), then the letter "a", and then on the screen an accented á would be displayed, as expected. But this doesn't work if you call ToAscii() or ToUnicode() in a low-level keyboard hook function. It seems that the dead key is destroyed, and so no accented letter á shows up