P3D v2 How to catch numeric- and arrow keys being pressed in P3D?

#1
From C# catching a "normal key" being pressed inside P3D works fine for me, however I can't seem to grab keys from the numeric keypad (ideally both with and without SHIFT and CTRL-SHIFT) or the 4 arrow keys. Within P3D I have disabled most keys but a few, so these keys should not be in conflict with the settings inside P3D.

The following code works fine for grabbing the "L"-key being pressed inside P3D:
simconnect.MapInputEventToClientEvent(INPUT_GROUPS.INPUT0, "L", EVENTS.EYEPOINT_LEFT, (uint)0, (EVENTS)unused, (uint)0, (bool)false);

But I don't know what to replace "L" with, in order to grab numeric/arrow keys in stead. As far as I am aware I have tried all combinations with/without a "VK_" prefix, "Num_1" or "Num1", or "Numpad1" or "Numpad_1", but so far it have been no joy.
 

JB3DG

Resource contributor
#2
Its a confusing bit....your arrow keys are the "Num_2/4/6/8". The number pad keys however are the "VK_NUMPAD0/1/2/3" etc. I believe the string is case sensitive and I suspect that for the VK_ keys to be active, NumLock must be on.
 
#3
Physically on the keyboard the arrow keys and num keys are separated (unless you press "Num Lock" in which case the Num-keys can function as arrow keys). Are you telling me there is no way to distinguish if e.g. the "Right" arrow key is pressed, or the "Num6" key? If it is possible with is "the name" of the arrow keys?

I am pretty sure that I did test with "VK_NUMPAD0" (in capital letters) without any luck, but I will give it a try to verify.
 

JB3DG

Resource contributor
#4
If num lock is off, both the number pad and arrow keys will trigger the "Num_X" events in simconnect. If num lock is on, arrow keys will trigger "Num_X" and number pad will trigger "VK_NUMPADX" events.
 
#5
If num lock is off, both the number pad and arrow keys will trigger the "Num_X" events in simconnect. If num lock is on, arrow keys will trigger "Num_X" and number pad will trigger "VK_NUMPADX" events.
OK it soulds strange that the arrow keys would generate a "Num_X" event (why not call it something like "Arrow_UP", "UP" or something along that line). Anyway you are not to blame for the poor naming of the keys. Thanks for your input, I will put it to a test.
 

JB3DG

Resource contributor
#6
View the Key strings document in the SDK and match the strings up in sequence with the virtual keys definitions in WinUser.h.
 
#7
No matter what, I cannot get the "VK_NUMPADx" to work in any way for form ... HOWEVER (thanks to you enlighting me the arrow keys being "Num_X") I figured out that:
"NUM_4" is arrow-left, "NUM_7" is home, and so on (or the keys 4 and 7 on the numeric keypad when NumLock is NOT enabled).

Now the REALLY odd thing (when NumLock is enabled) the numbers 4 and 7 on the numeric keypad are "SHIFT+NUM_4" and "SHIFT+NUM_7". So for instance when I set up P3D to send me an event when 4 on the numeric keypad ("SHIFT+NUM_4") I both get the even when pressing 4 on the keypad, and when holding shift pressing the LEFT-ARROW key.

Again - I could not get "VK_NUMPADx" to work, but now I know how grap the keys-presses on the numeric keypad ("SHIFT+NUM_x").

Thank you, for your help

Pelle
 
Last edited:
#9
Has anyone figured out the "VK_NUMPAD" numpad digit keys yet? I can't get them to work either... All other keys working fine, including numpad /, numpad +, etc... Are they just dead/not supported?
 
Top