Jump to content
The simFlight Network Forums

Emulated keystrokes lost


Recommended Posts

Hello, I have a 6 degrees of freedom device that I use to control the eyepoint with my own software. Because the relevant SimConnect features (SimConnect_CameraSetRelative6DOF(), EYEPOINT_UP and alike, PAN_UP and alike) and FSUIPC features (such as Eyepoint Right, Pan Right) do not work anymore, I had to modify my app (w.r.t. the FSX version) so as to emulate keystrokes. To do so, I first use SetForegroundWindow() to bring the MSFS window on foreground, then use either SendInputs() (or the older keybd_event()) or a Teensy microcontroller to send the keyboard messages.
This works, provided my software has started before FSUIPC7. When FSUIPC7 has started first, things are messed up: the MSFS window does not stay on foreground, keystrokes are lost, and sometimes the About window of FSUIPC7 opens (note that some keystrokes include the ALT key).
Can you understand the issue, does FSUIPC7 hook the keyboard or something similar?

FSUIPC 7.02, MSFS 1.12.13.0

Link to comment
Share on other sites

23 hours ago, d147 said:

FSUIPC 7.02

First, please update to v7.0.4. Only the latest version is supported.

23 hours ago, d147 said:

Can you understand the issue, does FSUIPC7 hook the keyboard or something similar?

Not! FSUIPC7 will try to assign (by default) ALT-F as a hot-key to open the FSUIPC7 main window. You can change or disable this - please see the user guide for details.

Other than that, FSUIPC7 will request key input events for (almost) all keys, but requests them unmasked and so should not affect any other SimConnect clients, let alone other windows applications!

23 hours ago, d147 said:

This works, provided my software has started before FSUIPC7.

And FSUIPC7 still works as expected? Is there any difference in the FSUIPC7 logs when starting your app before or after FSUIPC7?

John

Link to comment
Share on other sites

I solved the issue, but I answer first.

Quote

First, please update to v7.0.4. Only the latest version is supported.

Done.

Quote

And FSUIPC7 still works as expected? Is there any difference in the FSUIPC7 logs when starting your app before or after FSUIPC7?

FSUIPC7 works in either case. There are differences in the logs; here are samples:

FSUIPC started last:
    32063 EV_KEYUP received: 0x25 (%)
    32063 KEYUP: VK=37, Waiting=0, Shifts=0
    32063 .. KeyUp received from FS but not programmed

FSUIPC started first:
    31484 KEYUP: VK=98, Waiting=0, Shifts=0
    31484 .. KeyUp not programmed -- passing on to FS
    31484 **** keyUp sent via SendInput
 or
    31469 KEYUP: VK=16, Waiting=0, Shifts=0
    31469 .. KeyUp received from FS but not programmed

 

I discovered that FSUIPC window class name is "FS98MAIN" which is also the FSX window class name.

Since I try to have my apps compatible with FSX, FSW and FS2020, the handle needed to bring FS window to foreground was found using FindWindow("FS98MAIN", NULL), then FindWindow("FSWMAIN", NULL), finally FindWindow("AceApp", NULL). So when FSUIPC7 is started first, my apps find the FSUIPC7 window instead of the FS one.

So, I reversed the order of the FindWindow()'s and this solved the issue, since now, the right window is found. The FSUIPC7 log file now looks like when FSUIPC was started first, even when it is started last.

 

 

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.