Jump to content
The simFlight Network Forums

Sending keystrokes to FS9


Recommended Posts

Hi Pete,

This is a little bit "off topic", but since you are an professional at this area I decided to ask you. Maybe, you have an idea or hint.

I build some gauges at the moment, which simulates a virtual copilot (a bit like FS2Crew). But now I had to stop for a big problem - I´m not able to figure out, how to send keystrokes to FS9.


I´m using Key2Mouse, to access mouseclick-only-gauges in the cockpits via keystroke. This keystrokes should not pressed by the user, it should be "pressed" by my gauges, or via external software. Do you have any idea, how to do this? Is it possible, to send any keystroke-combination via your FSUIPC to FS9?

Kind regards


Link to comment
Share on other sites

Is it possible, to send any keystroke-combination via your FSUIPC to FS9?

Yes, of course. There are two ways, one easy but user-dependent, the other harder.

The easy way is to use the virtual buttons facility in FSUIPC. You get your program to change bits in the 3340-3363 range of offsets (288 "buttons"). These can be detected in the Bttons page in FSUIPC options, and there can be programmed to send keystrokes or FS controls, as usual.

The disadvantage of this way is only apparent if you plan to release your work to others, as they then need to have a user-registered FSUIPC and would ned to program these buttons. If they had anything else using the same virtual buttons they'd have difficulties.

The other way is to program via the offsets 3200-320B. This actually does send the Windows messages for KEYDOWN and KEYUP. But you have to remember that you need the whole sequence. For a combination of, for instance, Shift+Ctrl+A you'd need to send three KEYDOWN's and then the three KEYUPs.

This way is more flexible, but really FSUIPC is not doing much for you -- the reason the facility is there is for WideFS, so keystrokes can be sent to FS from client PCs. If you are running in the same PC (and for Gauges, even in the same Process!) it may be just as easy for you to send these messages by PostMessage direct to the FS window (class "FS98MAIN"). However, you may not get exactly the same result unless you do it using the Windows "SendInput" API as FSUIPC does -- messages like WM_CHAR may not be generated correctly otherwise.



Link to comment
Share on other sites

So I can convert the mouseclicks via Key2Mouse to keystrokes and than I can send these keystrokes directly to FS9. Great.

Er, no!

Key2Mouse is a program by Luciano Napolitano which converts keystrokes into mouse movements and clicks. It is used to click on gauges which don't recognise keystrokes. It sounds like the very opposite of what you are thinking!



Link to comment
Share on other sites

Sorry, that was bad english from my side.

For example, I have a gauge, which only accepts mouseclicks. So I can use Key2Mouse, to set up a keystroke, which - if pressed - simulates the mouseclick onto this gauge.

The different now is, that these keystroke is not send via user (keyboard) to Key2Mouse, but via my software/gauge.

The following workflow:

Software sends keystroke to FS9

(This keystroke is defined to simulate a mouseclick via Key2Mouse)

Key2Mouse now converts this sended keystroke into a mouse action.

I suppose, that´s the right way.

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.