Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hey all you VB gurus out there....

How do I read the 0609 offset.

I have tried Byte, Long, Integer, Double, and nothing works. I keep getting 0 or empty.

It is the Engine Type, Byte, DEC, and should return a number.

0 = Piston

1 = Jet

5 = Turboprop

But I just cant get it to work.

Please help

Thanks.

Posted

I just added it to one of my panels just to try, and it worked fine for me when DIM'd as an Integer.

Here's the code...

Dim Engine As Integer
Call FSUIPC_Read(&H609, 2, VarPtr(Engine), dwResult)
Call FSUIPC_Process(dwResult)
lblEngine = Engine

That worked.

Richard

Posted

OK that worked for me, it was the 2 that did it.

Thanks

Now how do I know what length to use in these things. That seems to get me into trouble all the time.

As In

Call FSUIPC_Read(&H609, #, VarPtr(Engine), dwResult)

How can I find out what number to put in the # spot? For the different offsets? is there a basic outline somewhere?

  • 3 weeks later...
Posted

Sorry for the delay in replying -- I've been on holiday with no Internet access. I'm just trying to catch up with an enormous backlog now!

OK that worked for me, it was the 2 that did it.

It will only work if, by sheer liuck, the byte after this is zero. No one will guarantee that, and it may depend on many other things.

The correct length for a 1 byte value is 1. Declare it as a byte or character or whatever the language calls something which is 8 bits long.

Now how do I know what length to use in these things. That seems to get me into trouble all the time.

The length in bytes is provided in the table in the Programmer's Guide. It is in the second column, called "size". That it the number of bytes. That is exacly what it is for, so you know how big the value is!

How can I find out what number to put in the # spot? For the different offsets? is there a basic outline somewhere?

Refer to the table I provide! That is EXACTLY it!!

You can read that 1 byte into an Integer, but since 1 byte is shorter than an Integer (the latter is usually 32 bits -- or 4 bytes), there may be rubbish in the other bytes still. All you need to do is set the Integer to zero (0), then read the one byte into it.

Pete

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.