keyboard-hook

Using CGEventSetIntegerValueField to edit a keyboard event gives error

丶灬走出姿态 提交于 2020-01-04 06:38:38
问题 So, I asked another question here: How to tell the difference between a user-tapped keyboard event and a generated one? One of the answers that came up was to use the "mouse pressure" field (unlikely to be used for a keyboard event) to mark the event as needed. So, I'm trying: CGEventSetIntegerValueField(myKeyboardEvent, kCGMouseEventPressure, 0xFEEDFACE); The problem is: I don't know what 0xFEEDFACE means. What does that value default to? What should I set it to? How can I check whether it

Receive Keyboard Events with Window Messages in a WPF-Window (HwndSource.AddHook)

♀尐吖头ヾ 提交于 2020-01-03 06:48:24
问题 I have a Window with a TextBox. The cursor is inside the TextBox. If I press a key, then I receive a message in WndProc (for KeyUp and KeyDown). But if I set e.Handled = true in the KeyUp and KeyDown events, then I don't receive any key messages: public partial class MainWindow : Window { public MainWindow() { Loaded += MainWindow_Loaded; } private void MainWindow_Loaded(object sender, RoutedEventArgs e) { var textBox = new TextBox(); textBox.KeyDown += TextBox_KeyDown; textBox.KeyUp +=

c# keyboard hook works for only 10 times then it stops (or is supressed)?

不打扰是莪最后的温柔 提交于 2020-01-03 03:48:06
问题 It is the classic low level keyboard hook that I have used several times before quite successfully but lately it does not work right. It reads the keyboard inputs for exactly 10 times (10 times from any of the keys defined in HookCallback function) and then it stops. It is like some security feature of the OS or some other program like maybe an anivirus is getting in the way and suppressing the keyboard hook after 10 times. Has anyone else encountered this 10 times limit? What could be the

How to get keyboard input while running in vmware virtual machine?

╄→гoц情女王★ 提交于 2020-01-01 14:43:13
问题 I'm logged into a virtual machine using vmware workstation 6.5-7.0.1 or vmware player 3.0.0. I'm working inside the virtual machine. Then I press a key (for example the Delete-Key, but it should work with every key) inside the virtual machine. I want to recognize the "key-press-event" in my C# application which is running outside of the virtual machine. Can you think of any way to do this? 回答1: I am not 100% sure if you can actually hook into the VM unless there's an SDK that you can download

Can you remap keys of a specific keyboard?

大兔子大兔子 提交于 2020-01-01 09:09:10
问题 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

Blocking shortcut keys using c#

ⅰ亾dé卋堺 提交于 2019-12-29 09:20:38
问题 I am using the below code to disable the Alt+Tab, Alt+Esc, Ctrl+Esc, and Windows Key but somehow it is not working. Please help me rectify it. namespace BlockShortcuts { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private delegate int LowLevelKeyboardProcDelegate(int nCode, int wParam, ref KBDLLHOOKSTRUCT lParam); [DllImport("user32.dll", EntryPoint = "SetWindowsHookExA", CharSet = CharSet.Ansi)] private static extern int SetWindowsHookEx( int idHook,

Low Level Keyboard Hook called intermittently, GetMessage never returns

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 02:49:36
问题 I set up a low level keyboard hook in a worker thread that also runs a message loop. About 1/3 of my key strokes trigger the hook function and none release the GetMessage function in my message loop. Because of something related to the latter, messages aren't queued either (I just started working with Windows' message loop). What would cause only some keystroke to trigger a hook? And is there some setting/function call I'm missing to have the GetMessage to work correctly (according to this I

Why does pressing Ctrl+“+” produce a beep in a TextBox?

白昼怎懂夜的黑 提交于 2019-12-23 19:18:53
问题 I am Working with C# and Windows Forms and want to use Ctrl+"Oemplus" as a function key for my application. I use a German keyboard and this key is located 2 keys right of the letter P (that ist then "+"). Whenever I press this key in combination with Ctrl and the focus is on a TextBox I get a beep. This also happens when I switch to an US keyboard layout (still using my German keyboard ). This is then the ] key . The same happens when pressing this key while in Internet Explorers address bar

ToUnicode doesn't return correct characters

与世无争的帅哥 提交于 2019-12-22 13:57:55
问题 I tried to call the ToUnicode inside a low level keyboard hook and print the character(s) it returned. However, it seems that the function doesn't take into account whether special keys, such as shift or caps lock were pressed, so the output is the same as from MapVirtualKey function with current key's virtual code passed as parameter. For example ( pressed keys => characters returned by ToUnicode ): abcd => abcd (correct) [caps lock]abcd => abcd (wrong: should be ABCD) ab[holding shift]cd =>

Is there a Java/C library which allows identify multiple keyboards?

两盒软妹~` 提交于 2019-12-22 11:35:31
问题 I need to connect more than one keyboard/mouse with a single computer. Manymouse library can identify different mouses, but is there a library which can identify different keyboards? I mean, when I press Key "E", the program can tell me which keyboard the KeyPress event is from. With C#, the SDGToolkit can do it, is there something in the Java world or C world, which supports all OS just as Manymouse does? I am more interested in Mac and Linux solution. 回答1: Know the solution. I can use a hid