keyboard-hook

Windows Global Keyboard Hook - Delphi

允我心安 提交于 2019-11-28 20:56:27
I've created a GLOBAL keyboard hook DLL, using source code found on the internet. For the best part it works brilliant, except when it comes to browsers. It picks up every key in the browser except, it seems, when the browser gets focus, it looses the first key that is pressed. Tested this in IE and Firefox and it seems to be the same for both. For instance, if I open IE and start typing www. , I only get back ww. If the browser window stays in focus no further keys are lost. As soon as the browser looses focus and regains focus, the first key is again missing. Could it be because of using

What can cause Windows to unhook a low level (global) keyboard hook?

岁酱吖の 提交于 2019-11-28 18:18:26
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 to be a consistent repro, I've heard that they can get unhooked due to timeouts or exceptions getting thrown, but I've tried both just letting it sit on a breakpoint in the handling method for over a minute, as well as just throwing a random exception (C#) and it

VB.NET Detecting Keypress While Minimized

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 14:47:58
I want to be able to detect when the user presses F10 or Ctrl+F10 outside of my program, and upon receiving the key press, it will send text to whatever they currently have selected (e.g. a text box). How can this be accomplished in the simplest way? CodesInChaos Use RegisterHotkey and not a keyboard hook to get a global hotkey. See one of my older answers on almost the same question: listen for a key when the application is not focused The first problem here is that the F10 key is already a reserved key for Windows applications. When the user presses it, the active application selects the

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

你。 提交于 2019-11-28 01:55:47
问题 How do I trap Windows key, Alt + Tab , and Ctrl + Alt + Delete in a Windows application using C#? 回答1: 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. 回答2: 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

Receive OS level key-press events in C# application

狂风中的少年 提交于 2019-11-27 23:06:41
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 (cmd) { case 13: // APPCOMMAND_MEDIA_STOP constant MessageBox.Show("Stop"); break; case 14: //

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

那年仲夏 提交于 2019-11-27 18:31:08
问题 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

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

一笑奈何 提交于 2019-11-27 18:20:55
问题 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

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

≯℡__Kan透↙ 提交于 2019-11-27 15:30:23
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 please, or all those on the system? There is no built-in way to find out who sent the window message,

Windows Global Keyboard Hook - Delphi

牧云@^-^@ 提交于 2019-11-27 13:18:38
问题 I've created a GLOBAL keyboard hook DLL, using source code found on the internet. For the best part it works brilliant, except when it comes to browsers. It picks up every key in the browser except, it seems, when the browser gets focus, it looses the first key that is pressed. Tested this in IE and Firefox and it seems to be the same for both. For instance, if I open IE and start typing www. , I only get back ww. If the browser window stays in focus no further keys are lost. As soon as the

What can cause Windows to unhook a low level (global) keyboard hook?

£可爱£侵袭症+ 提交于 2019-11-27 11:13:25
问题 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 to be a consistent repro, I've heard that they can get unhooked due to timeouts or exceptions getting thrown, but I've tried both just letting it sit on a