Jump to content
The simFlight Network Forums

Trying to use extra keypad for MSFS


khwsommer

Recommended Posts

I am trying to use an extra keypad to control some MSFS functions, e.g. Autopilot normally toggled by "z" on the keyboard. I have set

UseKeyboardHook=Yes

in my FSUIPC.INI

Also, I am using HidMacros to send a "z" when I am pressing the "1" key on my extra numpad. In MS Word, it all works well (i.e. it shows "z" when I press "1" on the extra numpad), but in MSFS and in FSUIPC  I only get "Num1".

So, I assume, the keystroke still goes through SimConnect as "Num1" and not through HidMacros and UseKeyboardHook as "z".

What is my mistake?

Thank you in advance

Klaus

 

Link to comment
Share on other sites

I am not familiar with HidMacros, but if you are using UseKeyboardHook=Yes then FSUIPC will grab all keyboard input (when an aircraft is loaded in MSFS) and so the focus window, and also HidMacros I assume, will not see the key press.

If you want to remap the "1" key to the "z" key (to be sent to MSFS), then you can do this in FSUIPC's key assignment dialog, where you can assign the "1" key press to the control Key Press & Release with a parameter of 90 (the "z" key). It may be better to assign the press to Key Press/hold and the release to Key Release, both with parameter 90, but you can try both and use whatever works best for you.

John

Link to comment
Share on other sites

Thank you, John, for your reply. It took me a moment since I was travelling.

I think I failed to describe the issue properly.

I think in Windows, MSFS and FSUIPC only one Keyboard is recognized. If you plug in a second one, it just acts the same as the normal first one and cannot be distinguished from it.

HidMacros is a program that does something very similar to FSUIPC with UseKeyboardHook=Yes, namely it catches all keypresses before they go to Windows (hooking). But in contrast to FSUIPC, HidMacros can identify the keyboard the keypress is coming from and it can convert the keypress to whatever you want, in my above example convert "Num1" from the second keyboard/numpad to "z". So "Num1" on the second keyboard (or numpad) is different from "Num1" on the the first normal keyboard and generates e.g. a "z" through HidMacros while the normal keyboard still returns only "Num1". This can be successfully confirmed in any text editing program.

The problem is that when using MSFS with or without FSUIPC, this hooking action of HidMacros does not seem to work like in a text editor. Both keyboards only generate the "Num1". (I assume without knowing enough that Simconnect catches the keypress before HidMacros does)

So I wonder whether

a) FSUIPC could also distinguish between the two keyboards (source code of HidMacros is available at Github: https://github.com/me2d13/hidmacros ) or

b) FSUIPC could read the output from HidMacros instead of the keystream that just generates a "Num1". I tried UseKeyboardHook=Yes for that reason but it does not do that

I hope this is a better description of the issue. It would be so nice to use cheap additional keyboards or numpads like the one in the link below to have many additional keys available for MSFS functions.

I hope you can help.

Klaus

https://www.amazon.de/dp/B01N7WOXLU?psc=1&ref=ppx_yo2ov_dt_b_product_details

https://www.hidmacros.eu/whatisit.php

 

Link to comment
Share on other sites

51 minutes ago, khwsommer said:

I think in Windows, MSFS and FSUIPC only one Keyboard is recognized. If you plug in a second one, it just acts the same as the normal first one and cannot be distinguished from it.

Correct.

53 minutes ago, khwsommer said:

So I wonder whether

a) FSUIPC could also distinguish between the two keyboards (source code of HidMacros is available at Github: https://github.com/me2d13/hidmacros )

I can look into this at some point I guess (i.e. add it to my to-do list), but unfortunately I think it would be many years before I had time to look into such an issue. There are many things I need to look into that would be far more useful to a far larger audience, and my developmet time is limited due to the amount of time I am spending on support...

56 minutes ago, khwsommer said:

b) FSUIPC could read the output from HidMacros instead of the keystream that just generates a "Num1". I tried UseKeyboardHook=Yes for that reason but it does not do that

I don't think that would be a possibility, especially without changing the HidMacros code, which I am not prepared to do.

Looking at HiDMacros, it does say:

Quote

The command can be either keyboard shorcut sent to FS window or SimConnect event (see FSX SDK for available events and their description).

so doesn't it work if you just turn-off (i.e. remove) UseKeyboardHook=Yes? If you use HidMacros to send the keyboard shortcut to the FS window, that should then send the "z" key (on numpad1) to the FS, which would then be picked up as the "z" key by FSUIPC where it can be assigned. Is that not the case?

Otherwise, you could try using numlock on on one keyboard and off on the other, which would allow you to distinguish between the numpad keys on the different keyboards, but not the other keys.

John

Link to comment
Share on other sites

Thank you, John. I know you are very busy and I feel bad about bothering you. But there is no one else 😉.

Here my findings:

  • HidMacros alone generates "z" in Browser, Text Editors, etc., but "Num1" in MSFS and FSUIPC.
    (I am not surprised about FSUIPC, since I understand FSUIPC gets the key from MSFS via Simconnect).
  • HidMacros plus UseKeyboardHook=Yes still only gives "Num1" in MSFS and FSUIPC (and "z" in editor etc.). To me that means that either FSUIPC gets the keystroke before HidMacros or on another way than HidMacros or UseKeyboardHook=Yes is not doing anything in this situation.

I believe this is the end of the road or do you have any other suggestions?

Thank you.

Klaus

 

(P.S.: NumLock=Off on the main keyboard (no HidMacros) generates strange behavior on the second numpad. Some keys come through but there is always a NumLock=On on keypress and NumLock=Off on key release in addition. With HidMacros, the key is converted with KeyLock=On on the main keyboard and without that it's again pretty strange. So this will not help.

P.P.S.: Since HidMacros is no longer supported for MSFS, it cannot use Simconnect to connect to MSFS, but otherwise works just fine with other programs. But Simconnect should not be needed anyway, since the hooked and reassigned keypresses from HidMacros worked just fine in FSX (and now also in editors/browsers, but not in MSFS.)

Link to comment
Share on other sites

5 hours ago, khwsommer said:

(I am not surprised about FSUIPC, since I understand FSUIPC gets the key from MSFS via Simconnect).

Yes, unless UseKeyboardHook=Yes is used, in which case a global windows hook is used and the key presses/releases are received from Windows.

5 hours ago, khwsommer said:

HidMacros plus UseKeyboardHook=Yes still only gives "Num1" in MSFS and FSUIPC (and "z" in editor etc.). To me that means that either FSUIPC gets the keystroke before HidMacros or on another way than HidMacros or UseKeyboardHook=Yes is not doing anything in this situation.

I can't comment on how HidMacros gets its input (haven't looked at the code), but FSUIPC will fet it direct from windows before any processing by other applications when UseKeyboardHook=Yes is used.

5 hours ago, khwsommer said:

(P.S.: NumLock=Off on the main keyboard (no HidMacros) generates strange behavior on the second numpad. Some keys come through but there is always a NumLock=On on keypress and NumLock=Off on key release in addition. With HidMacros, the key is converted with KeyLock=On on the main keyboard and without that it's again pretty strange. So this will not help.

Ok, doesn't surprise me really. I'm not sure how this works when using multiple keyboards...I don'r know how windows handles multiple keyboards as they are not Hid joystick type devices, which is what I am familar with. I know very little about other types of Hid devices, sorry.

5 hours ago, khwsommer said:

P.P.S.: Since HidMacros is no longer supported for MSFS, it cannot use Simconnect to connect to MSFS, but otherwise works just fine with other programs. But Simconnect should not be needed anyway, since the hooked and reassigned keypresses from HidMacros worked just fine in FSX (and now also in editors/browsers, but not in MSFS.)

I think this is the issue....

5 hours ago, khwsommer said:

I believe this is the end of the road or do you have any other suggestions?

I think someone needs to update HidMacros to be compatible with MSFS - would seem to be the obvious solution. Unfortunately I am not in a position to look into this.
You could maybe ask about this on the Asobo forums, or maybe over on avsim.

Sorry I can't be of more help.

Regards,

John

Link to comment
Share on other sites

Thank you, John, for your detailed comments.

Yesterday, I found a solution.

Using UCR (see below) one can reassign any key from any keyboard (or any control device for that matter) to any key combination (or any control device action) you want. If you want to use it, you will probably need to use "blocking" in UCR for the input keyboard, or you will get both outputs (from the second keyboard and the UCR assignment).

https://github.com/Snoothy/UCR

I have used free key combination for MSFS and within FSUIPC I then assign these to any available presets, in my case for the FlightFX HJET.

Works without a flaw. I think this is a really efficient (= cheap) way of using extra numpads or keyboard for controls in MSFS.

Thank you for your patience and support.

Klaus

P.S.: The FlightFX HJET HA420 presets in events.txt are no longer up-to-date for version 2 of the FlightFX HJET HA420. To help a little bit, I intend to put all the new ones into my myevents.txt and then send it to you. You may then consider including them in a future update.

Link to comment
Share on other sites

27 minutes ago, khwsommer said:

Yesterday, I found a solution.

Using UCR (see below) one can reassign any key from any keyboard (or any control device for that matter) to any key combination (or any control device action) you want. If you want to use it, you will probably need to use "blocking" in UCR for the input keyboard, or you will get both outputs (from the second keyboard and the UCR assignment).

https://github.com/Snoothy/UCR

I have used free key combination for MSFS and within FSUIPC I then assign these to any available presets, in my case for the FlightFX HJET.

Works without a flaw. I think this is a really efficient (= cheap) way of using extra numpads or keyboard for controls in MSFS.

Ok,, thanks for the update. Glad you found a solution.

27 minutes ago, khwsommer said:

P.S.: The FlightFX HJET HA420 presets in events.txt are no longer up-to-date for version 2 of the FlightFX HJET HA420. To help a little bit, I intend to put all the new ones into my myevents.txt and then send it to you. You may then consider including them in a future update.

Are these events in the MF Hub Hop site? I only update the events.txt file on releases - it is up to you, the user, if you want to update between releases.
No point sending me the file as I update this from the MF Hub Hop site before release. You can submit them to the Hub Hop site if not already there.
A later beta version is available, 7.3.18c, which contains the latest evemts.txt file as of yesterday, available here: 

 

John

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.