Jump to content
The simFlight Network Forums

Visual Stupid Basic 6, FLOAT64 data + stupid me = question !


Recommended Posts

I am so sorry to bother everyone with this, I get the feeling that the topic has been dealt with in the past to the point where people kick their monitors when messages like this pop up, but I've spent more than a week on this and searched endlessly through the forum.

I am reading offset 2038 for example, from VB with the latest FSUIPC.

(everything works fine other than this)

on FSInterrogate the correct value displays under FLOAT64, where random values appear on INT, and WORD, etc.

I read about the FAKE64 currency variable,

so I used

Dim itt As Currency
Dim itttwo As Double

  If FSUIPC_Read(&H2038, 8, VarPtr(itt), dwResult) Then

      If FSUIPC_Process(dwResult) Then

           itttwo = (itt * 10000#)
           Label1.Caption=itt & "     " & itttwo

......

My label shows

itt = 464781744737377.0974

itttwo = 4.64781744737377E+18

and fsinterrogate shows

FSInterrogation.gif

ignore the box where the cursor is, I was WRITING some other values to see the reaction in VB

Can anyone please tell me how to get the correct numbers on VB6 ?

I have been fiddling with it forever and everything is working wonderfully, except for this... and a great deal of data comes in as 64bit through FSUIPC...

Thank you all in advance, sorry to waste your time.

In the future I plan to release my work so everyone can enjoy it... basically, it'll involve FLASH, MSFS and possibly some DIY parallel switches and lights... freeware .......

I've been researching endlessly and found some useful info on the way VB stores date, little-endian and IEEE 64-bit format.... am I on the right track ?

Please help !!!! :roll:

THANK YOU !! :wink:

Link to comment
Share on other sites

on FSInterrogate the correct value displays under FLOAT64, where random values appear on INT, and WORD, etc.

I read about the FAKE64 currency variable,

so I used

Dim itt As Currency
Dim itttwo As Double

  If FSUIPC_Read(&H2038, 8, VarPtr(itt), dwResult) Then

      If FSUIPC_Process(dwResult) Then

           itttwo = (itt * 10000#)
           Label1.Caption=itt & "     " & itttwo

......

Why bother to read it into an INCORRECT variable type (currency) then copy it into the correct one (double)? I am not a VB programmer, but surely it would be better to do this:

Dim itttwo As Double
  If FSUIPC_Read(&H2038, 8, VarPtr(itttwo), dwResult) Then

......

Do whatever you like with the double value "itttwo" afterwards, but surely don't read it into a fixed point variable first! That makes no sense to me.

Regards,

Pete

Link to comment
Share on other sites

Dear Pete,

A while ago it seemed that visual basic did not have any 64bit variables, so people (although microsoft denied) found out that the CURRENCY variable was actually a 64bit one that was scaled to have 4 decimal digits.... anyhow, I did just what you said though, and it worked wonderfully !!! I might purchase another license, just for the hell of it !!! :)

Best regards,

Doug.

Link to comment
Share on other sites

A while ago it seemed that visual basic did not have any 64bit variables, so people (although microsoft denied) found out that the CURRENCY variable was actually a 64bit one that was scaled to have 4 decimal digits.

For fixed point numbers that might have been true. It's only recent C compilers, for instance, that support "long long" 64 bit fixed point values --- most of my programs (like TrafficLook) were written without such luxuries and have to mess around converting two separate 32-bit values into one floating point one for both Latitude and Longitude.

However, the "double" 64-bit floating point type is a standard Intel hardware supported representation and has been around for as long as there has been Pentium (and even 80x86 I believe) floating point hardware, and I'm pretty sure VB as well as C has supported them for a long time.

... anyhow, I did just what you said though, and it worked wonderfully !!!

Good. But I still don't know VB! :)

Regards,

Pete

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.