keyboard-events

SendInput vs. keybd_event

て烟熏妆下的殇ゞ 提交于 2019-12-01 19:46:11
MSDN states that keybd_event has been superceded by SendInput. During a rewrite I switched to using SendInput...which was fine except when trying to send an Alt-key combination. On a Win7 64-bit system (haven't tried elsewhere yet), send an Alt-key causes a long delay before the keystroke is apparent in the target application. Any ideas why? Or what I've done wrong? For now, I've gone back to keybd_event--the second version below. //Keyboard input from this version appears only after a ~4-5 second //time lag... procedure SendAltM; var KeyInputs: array of TInput; KeyInputCount: Integer; //-----

Catching Qt modifier key releases

青春壹個敷衍的年華 提交于 2019-12-01 18:54:35
I'm a newcomer to Qt, but I'm trying to implement what basically amounts to a video-game-esque input loop in a Qt application (crazy, I know, but see if you can help). I need accurate, one-to-one event handling for key presses and key releases, for all keys, including modifiers, no matter how weirdly you chord-up the keyboard. Of course, your main access to key events is through QKeyEvent . But let's say the following happens: user presses and holds Ctrl user presses and holds Up user releases Ctrl and Up simultaneously As far as I can tell, what I get from Qt is: QKeyEvent for the pressing of

GLUT key down and key up on CTRL key

狂风中的少年 提交于 2019-12-01 18:43:32
I've found a lot of information about using GLUT to detect whether the Ctrl key is pressed using the GLUT_ACTIVE_CTRL macro. This macro only works, apparently, within a keyboard or mouse callback function. I need to know whether or not the Ctrl key is pressed at a point in my main loop, but GLUT_ACTIVE_CTRL doesn't seem to work in this context. So, is there a way to detect key up and key down events on the Ctrl key (without any other keys being typed) in a platform independent GLUT-ish way? EDIT: The keyboard callback is not fired (at least for a default setup) when the Ctrl key is pressed.

GLUT key down and key up on CTRL key

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 18:40:16
问题 I've found a lot of information about using GLUT to detect whether the Ctrl key is pressed using the GLUT_ACTIVE_CTRL macro. This macro only works, apparently, within a keyboard or mouse callback function. I need to know whether or not the Ctrl key is pressed at a point in my main loop, but GLUT_ACTIVE_CTRL doesn't seem to work in this context. So, is there a way to detect key up and key down events on the Ctrl key (without any other keys being typed) in a platform independent GLUT-ish way?

SendInput vs. keybd_event

你离开我真会死。 提交于 2019-12-01 18:39:53
问题 MSDN states that keybd_event has been superceded by SendInput. During a rewrite I switched to using SendInput...which was fine except when trying to send an Alt-key combination. On a Win7 64-bit system (haven't tried elsewhere yet), send an Alt-key causes a long delay before the keystroke is apparent in the target application. Any ideas why? Or what I've done wrong? For now, I've gone back to keybd_event--the second version below. //Keyboard input from this version appears only after a ~4-5

Disable the Ctrl-Alt-Delete event through Java program

隐身守侯 提交于 2019-12-01 18:09:22
I am creating a desktop application using the JDesktopPane. I'm almost complete, but when I press ctrl + alt + del , it leaves my application. How can I prevent that action? Fact is Alt + Ctrl + Del never actually entering your application. Os traps Alt + Ctrl + Del before it is send to your application. So you can't trap it. sabbour Alt + Ctrl + Del cannot be overridden. It is a security feature. Itay Maman You cannot do that. The behavior of Alt + Ctrl + Del is enforced by the operating system, for good reasons: it makes sure that you can always bail-out of a faulty application. http://www

Why does my keyboard hook receive the same key-up and key-down events multiple times?

为君一笑 提交于 2019-12-01 17:53:00
In my previous question , I reported that a keyboard hook was reporting everything twice when scanning a barcode. I put that down to key down & key events and received good advice. Having looked at it more closely I find that each digit is actually being report FOUR times! Here's a crude "debug by print". Can anyone suggest what I might be doing wrong? Do you need more info? I could just ignore every second input, but ... yeuck! I would rather understand what is happening. Here's what I got for a single digit 2 --------- LongParam = 196609 | Word = 50 | 2 LongParam and $80000000 = 0 LongParam

Why does my keyboard hook receive the same key-up and key-down events multiple times?

我怕爱的太早我们不能终老 提交于 2019-12-01 17:51:38
问题 In my previous question, I reported that a keyboard hook was reporting everything twice when scanning a barcode. I put that down to key down & key events and received good advice. Having looked at it more closely I find that each digit is actually being report FOUR times! Here's a crude "debug by print". Can anyone suggest what I might be doing wrong? Do you need more info? I could just ignore every second input, but ... yeuck! I would rather understand what is happening. Here's what I got

Keyboard event propagation in winforms

房东的猫 提交于 2019-12-01 16:10:37
问题 I have a user control. Within the user control, there is a PictureBox that uses up the entire screen estate (Dock.Fill). I would like to catch keyboard events (e.g., Ctrl-V for implementing Paste functionality). However, the PictureBox does not have any key events. Will the next layer under the PictureBox (i.e. the user control) get the KeyUp event? If I add my KeyUp event handler to the user control, will that work? I know that WPF has the solution of routed events. How does that work in

Create a simple, unmodified key binding in WPF

泪湿孤枕 提交于 2019-12-01 16:05:52
I'm trying to create a very simple WPF application. I'd like to have an command handler called when the user presses "H" (not Control-H or Alt-H, just H). If I use the following in code-behind code: var gesture = new KeyGesture(Key.H, ModifierKeys.None); var inputBinding = new InputBinding(MyRoutedCommand, gesture); InputBindings.Add(inputBinding); I immediately get an exception saying that the key and modifier combination isn't supported for KeyGesture. (I get the same exception if I create the XAML to do the analogous thing). My application doesn't accept typed input, no text boxes are in