Jump to content
The simFlight Network Forums

FS “Add-Ons” menu for my app


Recommended Posts

Hi.

I've created an application that works fine. I'll like to show it in the "add-ons" menu, but can't get it to work.

I program in vb.net and this is the code for showing the menu. What is my mistake?

Global declarations

Dim MenuFS As Offset(Of Byte()) = New FSUIPC.Offset(Of Byte())(&H3210, 4)

Dim MenuNameFS As Offset(Of String) = New FSUIPC.Offset(Of String)(&H2FE0, 32)

In main form event

MenuFS.Value(0) = 255

MenuFS.Value(1) = 255

MenuFS.Value(2) = 0

MenuFS.Value(3) = 0

MenuNameFS.Value = "1Test menu"

Timmer of 10 secs

MenuFS.Value(0) = 255

MenuFS.Value(1) = 255

Edit: Also tried writing to bytes (2) and (3) insted of (0) and (1) but at least as is originally, I can see byte (1) counting down for timeout.

Debuggig I can see that

Link to comment
Share on other sites

I'll like to show it in the "add-ons" menu, but can't get it to work.

I program in vb.net and this is the code for showing the menu. What is my mistake?

I'm afraid there's more than one "mistake". I don't know VB but I can see several at a glance:

Dim MenuFS As Offset(Of Byte()) = New FSUIPC.Offset(Of Byte())(&H3210, 4)

Two things wrong here: First the data starting at 3210 is an ARRAY of DWORDS, or 32-bit values. In VB you probably have to treat them as integers -- but check the size your compiler produces for that.

Second, if you assume that the first slot, the one at 3210, is "free" and simply write to it, your program will not cooperate with any other program using hot keys or menu entries. As the documentation says, you should search for a free (all zero) entry and use that.

MenuNameFS.Value = "1Test menu"

The document tells you that the first byte must be the SLOT NUMBER (I). You would have seen the slot offset computed by 0x3210 + 4*I. So the slot at 3210 would be slot number 0 (zero). Right?

You've used "1". not even the NUMBER 1, but the CHARACTER 1, which, assuming the VB compiles into ASCII, is actually a byte value of 49 (hex 0x31), not 0 nor 1!

And that's assuming your VB compiles into normal ASCII. I think VB might default into compiling into wide characters or Unicode or somesuch.

Pete

Link to comment
Share on other sites

Thanks Pete for the super-fast answer :D .

First the data starting at 3210 is an ARRAY of DWORDS, or 32-bit values.

Yes, I got the idea, and I'm using 4 bytes (4 * 8 ) that give me the 32bits. I treat each byte separately. Maybe it's not good idea, but for testing and learning gives me better view of the situation.

Probably my mistake is using the "1" as character, besides that it should be 0 (I did also test it with 0)

Tonight I'll recheck it let you know the results.

Thanks

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.