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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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.