Jump to content
The simFlight Network Forums

Help with sending a keystroke (offset 3200)


Recommended Posts

Here's what I'm trying to accomplish.  I've got a third party aircraft that contains a custom gauge.  Within the gauge a custom event is fired with a mouse click.  I need to emulate the mouse click through FSUIPC (I've got a hardware input that I need to use to fire the event).  What I've gotten to work is assigning a mouse macro to a keystroke (ie, I press 1 and the proper event gets fired).

 

Where I'm stuck is figuring out how to send the 1 keystroke.  The docs say that the full 12 bytes must be sent, but I can't figure out how to translate the 1 to the 12 bytes.  I've found that the keystroke 1 has a value of 49, but how does that get translated into a 12 byte value?

 

I guess what my question boils down to is, if I want a keystroke of 1 to be sent, what value would I set the 3200 offset to?

 

Thank you.

Link to comment
Share on other sites

Here's what I'm trying to accomplish.  I've got a third party aircraft that contains a custom gauge.  Within the gauge a custom event is fired with a mouse click.  I need to emulate the mouse click through FSUIPC (I've got a hardware input that I need to use to fire the event).  What I've gotten to work is assigning a mouse macro to a keystroke (ie, I press 1 and the proper event gets fired).

 

I'm completely confused here. Isn't this "custom event" assignable in the first place? What sort of event is it? Most "custom events" can be assigned directly in FSUIPC (where they are called controls rather than events).

 

I need to emulate the mouse click through FSUIPC

 

Only the Lua mouse library offers that facility, so it would need a plug-in.

 

What I've gotten to work is assigning a mouse macro to a keystroke (ie, I press 1 and the proper event gets fired).

 

Ah, so the gauge is mouse-macro susceptible! Mouse macros don't actually issue mouse clicks at all. They simply call the same code in the gauge which your click would have called.

 

Why are you assigning to a keypress? Why not directly to your harware switch or button?

 

Where I'm stuck is figuring out how to send the 1 keystroke.  The docs say that the full 12 bytes must be sent, but I can't figure out how to translate the 1 to the 12 bytes.  I've found that the keystroke 1 has a value of 49, but how does that get translated into a 12 byte value?

I guess what my question boils down to is, if I want a keystroke of 1 to be sent, what value would I set the 3200 offset to?

 

So you are wrinig a program, interfacing to FSUIPC, to connect your hardware? It isn't a standard joystick type connection?

 

Offset 3200 is 12 bytes because it is for constructing a "PostMessag" call to FS's main window with the Message, WPARAM and LPARAM values all set as you might wish. All those values are 32 bits in length, and 4 x 32 = 128 = 12 bytes! To use the facility at 3200 you areexpected to be a programmer and to be able to look up the correct values to be used withWM_KEYDOWN and WM_KEYUP messages. And of course, unless you want the key to appear stuck down, you need to first send the correct KEYDWN message and then the correct KEYUP message.

 

As you appear to be a programmer, I'm sure you must have references to Windows progrmming documentation on these matters.

 

Why not simply tell FSUIPC to execute the macro directly, why do it via a keystroke? See offsets 0D70 and 0D6C. If you really really want to send a keystroke, it is much easier to send the FSUIPC control for a keypress and release (number 1070 in the list on about page 30 in the Advanced Users guide). You can send any controls via offset 3110.

 

Regards

Pete

Link to comment
Share on other sites

Hi Pete,

 

I'm completely confused here. Isn't this "custom event" assignable in the first place? What sort of event is it? Most "custom events" can be assigned directly in FSUIPC (where they are called controls rather than events).

 

 

Sorry, by custom event I meant something that they are handling completely internal to their gauge (they are picking up the mouse click and then doing a bunch of stuff).  They are not registering any actual custom events that I can hook into any other way, so that's why I'm looking at the mouse macro solution

 


Why are you assigning to a keypress? Why not directly to your harware switch or button?
 

 

So you are wrinig a program, interfacing to FSUIPC, to connect your hardware? It isn't a standard joystick type connection?

 

Offset 3200 is 12 bytes because it is for constructing a "PostMessag" call to FS's main window with the Message, WPARAM and LPARAM values all set as you might wish. All those values are 32 bits in length, and 4 x 32 = 128 = 12 bytes! To use the facility at 3200 you areexpected to be a programmer and to be able to look up the correct values to be used withWM_KEYDOWN and WM_KEYUP messages. And of course, unless you want the key to appear stuck down, you need to first send the correct KEYDWN message and then the correct KEYUP message.

 

As you appear to be a programmer, I'm sure you must have references to Windows progrmming documentation on these matters.

 

Why not simply tell FSUIPC to execute the macro directly, why do it via a keystroke? See offsets 0D70 and 0D6C. If you really really want to send a keystroke, it is much easier to send the FSUIPC control for a keypress and release (number 1070 in the list on about page 30 in the Advanced Users guide). You can send any controls via offset 3110.

 

I'm running in a client/server mode where I've got all my hardware running into my 'client' machine where I then process everything and then send values/commands to Prepar3d via SimConnect on the 'server' machine.  So, it can't be an actual keypress or joystick input that ends up firing the macro, but something that I'm sending remotely.  Since there are no custom event hooks, I can't do this via SimConnect and need another solution.  While I am a programmer, I'm not a Windows programmer and this will be my first forray into FSUIPC, so I want to make sure I'm heading down the right road with this as a solution before I invest the time into implementing just to find out I can't do what I need to do.

 

Anyway, I think offset 0D70 should be exactly what I need since I know the macro does do what I need it to do, so I really just need to fire it off from my 'client' machine.

 

Thanks for your help

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.