Jump to content
The simFlight Network Forums

VB - Offsets returns zero.

Recommended Posts

I am defnately missing something huge.

Why does all my read commands return zero to some of the basic ofsets. Is it something to do with my reg key or what. I do not think so.

What does the varPtr() function mean?

Am I correct in asuming that the data type I need to use must corelate to its size. E.g. if I need to read e.g. Ground altitude at 0020 then I would use a Long data type in VB which is 4 bytes long??

Offset 3C00 which I presume is a string, what VB data type should I use? String does not seem to work.

Thanks for all the help.

Link to comment
Share on other sites

We need to know / see what you have tried to read???

VarPtr i think means "Variable Pointer"?

Not to sure, i just use it....

   Call FSUIPC_Read(&H570, 8, VarPtr(varTest), varResult)
   Call FSUIPC_Process(varResult)

the above code will read & store the aircrafts altitude into the variable varTest

This variable "varTest" is dimmed as a "Currency" type as it requires a decimal point..

the "varResult" is used to queue the commands / reads / writes....

the FSUIPC_Process is used to send / process that queue.

In general when using a new offset for the first time i will start with

a "Long", then a "Double", then a "Currency", Then a "String" followed by other combinations...

As pointed out the VB documentation for FSUIPC, the currency datatype is perfect for reading in the latitude / longitude.....

when testing i generally place the following type of code in a command button for simple testing...

   Call FSUIPC_Read(&H570, 8, VarPtr(varTest), varResult)
   Call FSUIPC_Process(varResult)
   Msgbox varTest

If you post a particular problem i'm sure someone will be willing to help with an answer.

Hope this helps??

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.