Capturing shift key state on Windows 8 tablet in MFC App - windows

Our MFC-based Windows application has functionality that depends on the state of the shift key. Shift exposes power-user menu commands and shift-dragging has different behavior than normal dragging. I am exploring our options in supporting Windows 8 tablets, and it seems that there is no straightforward way to detect the state of the Windows 8 soft keypad shift key.
Using GetAsyncKeyState(VK_SHIFT) (our current method) doesn't detect this key.
Experimenting with examining all incoming keyboard messages, I find:
A single isolated tap of the shift key produces no keyboard event
A double tap of the shift key produces a caps lock key event, indistinguishable from a normal caps lock key event
A single tap of the shift key followed by another keystroke (eg. the 'q' key) produces a shift key event, the keystroke, and a shift key (up?) event.
Are there any other ways I could try to detect the state of the soft keyboard shift key? Has anyone else had success detecting the state of this keypad on Windows 8 tablet soft keyboards.
The external keyboards that you plug into these devices all have normal behaving shift keys. The problem is specific to the soft keypad.

Related

What is the AHK keycode for the auto-rotate button?

I'm attempting to remap a physical button on my laptop that triggers the auto-rotate toggle inside Windows 10. I know the keyboard shortcut for this Windows+O which would be #o in AutoHotKey.
With the following code snippet I can swap the autorotate key and volume down key (just an example).
#o::Volume_Down
Volume_Down::#o
But what is the underlying signal/keycode that Windows+O triggers, and can I trigger it with a keycode instead of with #o?
Turns out there is no keycode for this. It's a key combination: Win+O. The key on the side of the laptop simply sends Win+O.

Keyboard event on windows

I need to test keyboards keys so I created a virtual keyboard and light up keys when they are pressed>
On windows I get an issue, two key never send any signal : the print key & function key (located between the right alt gr and the right ctrl)
Also some key activate various signal when pressed (like turning on or off the sound...)
How can get a signal from these two keys with Qt ?
How can I override windows control over the keyboard during the test so that I will be the only one to receive keyboard input ?

osx fn and select key not responding on external keyboard

I have a MacBook Pro (from 2015) and an external keyboard (DuckyZero 2108).
I have already swapped the modifier keys 'option/alt' and 'command' on the left side of my external keyboard to make it behave like my internal keyboard.
I have tried to map the 'fn' key, which is on the right side of my external keyboard, to 'option/alt' with KeyRemapFor4MacBook (karabiner) with no succes. Againt, to make sure that my external keyboard behaves like my internal keyboard.
It seems that the keys 'fn' and 'select' on my externel keyboard are not detected when pressed by my MacBook (checked this with Keyboard Viewer), thus mapping with KeyRemapFor4MacBook has no effect.
The 'fn' key works on hardware level and the 'select' key is detected by http://www.keyboardtester.com/tester.html (could not test the 'fn' key on keyboard.com due to the absence of the 'fn' key in their layout).
My question is, is it possible to make the 'fn' and/or 'select' key on my external keyboard respond/detect after being pressed, so that I can remap it to 'option/alt'?

Ignore physical keyboard state when using SendInput

So I'm currently using SendInput as a way of doing keyboard emulation. My problem is that to switch on the emulation the user has to hold down the CTRL button (client's specification :-( ).
I used GetAsyncKeyState(VK_CONTROL) to get the state of the CTRL key, so I can work out the switch part. My problem now is that since the physical CTRL button is pressed, it is not ignored when the SendInput function is used. So instead of emulating say the c button it emulates CTRL + c.
I'd like to know if there is a way for SendInput to ignore physical keyboard presses.

Using Numpad with Modifier Keys exhibits curious behavior

I have a keyboard event listener, and I am listening for the number pad key codes (1 through 9) for when number lock is activated; this works fine. However, in my app I also want to allow usage of a modifier key (CTRL) along with the number pad keys. The strange thing is that when holding CTRL, pressing 1 or 3 does not generate any keyboard event whatsoever, whereas 2 and 4 - 9 do generate the expected events. I have seen other references to this issue after some Googling, so I do not believe this is necessarily Flash-specific, but I have yet to find any answers.
I tried using SHIFT as a modifier, but that just results in generating the key codes from the number pad as if number lock was off (eg, SHIFT+Numpad1 returns the End keycode, regardless of number lock state) - apparently this is intentional Windows behavior. ALT is not an option with the numpad due to altcodes.
Any ideas on how to get CTRL+Numpad1 and CTRL+Numpad3 to generate the keyboard events? Or any explanation as to why they don't?
Edit: I tried out using these key combinations in Firefox as enriquein suggests below, and all the key combinations work A-OK, leading me to believe that this is likely a Flash-specific issue, or at least not a hardware issue.
I have run into issues in the past with numpad keys on specific keyboards. Various key combinations fail to register on specific keyboards, and it is possible that the keyboard you are using may just not be generating any event in that case. It's not guaranteed to work, but I would recommend trying out a different keyboard (different vendor, etc) and see if that works. It also might be an issue with localized keyboards, if you are using a non-english keyboard.
I'm almost certain it's not Flash related because I had similar problems with a localized keyboard and could not get it to generate events at all for certain keys or key combinations.
Try enumerating all key events and searching trough what they're mapped to, or google evtest.c, compile it and run it and see what it has to say.
Indeed it looks like its keyboard specific. I tried the key combinations as I read this question in Firefox and they triggered the same event as pressing Ctrl+Number (which is switch to tab #Number).
This was using a standard US/101-key english keyboard (no extra media buttons or anything).
Some keyboards don't register certain key combinations. I think that this is down to how they are put together. For example some may register left hand Ctrl + key combination but not right Ctrl + same key!
A work around would be to detect the key down and key up events for the Ctrl key.
You could then raise a custom event for Ctrl + numpad key or work with a volatile flag to show the Ctrl key state.

Resources