Jump to content

FSUIPC4 with VB6


Recommended Posts

Hello,

I'm trying to make to use a VB6 program to interface with FS, and be able to set some auto pilot controls.

Such as the Nav frequencies, IAS, alt and vs.

I've worked out how to obtain the values from the sim, and used FSInterrogate2, to work out the address value and what the value is encoded in.

For Nav and radio it seems to be in hex minus the one at the begining.

This is what it comes out with in FSInterrogate2, and I can work with this quite easy.

0x1030 = 110.30

But when I use the example program in the VB SDK(UIPCHello), This is the value I come out with.

681612822

That is made up of 4 parts in VB.

I've tried everything with this number, converted to 16 bit binary first, then to hex, or straight into hex and still I can't get the correct value to display in VB.

Any ideas?

Thanks

Link to comment
Share on other sites

But when I use the example program in the VB SDK(UIPCHello), This is the value I come out with.

681612822

That is made up of 4 parts in VB.

I've no idea what you mean by "4 parts", but since all of the radio frequencies are only 16-bit (2 byte) values, and the maximum possible number in 16bits, treating it as unsigned, is 65535, the number you are getting obviously does NOT come from reading a 16-bit frequency or any other 16-bit value for that matter).

Regards

Pete

Link to comment
Share on other sites

This is what I use in vb.net with Paul Hentys VB.net DLL

Dim rnav1freq As Offset(Of Short) = New FSUIPC.Offset(Of Short)("aircraft radios", &H350)

nav1freq = rnav1freq.Value 'freq tuned into nav1

nav1freq = Val(Str(Hex(nav1freq))) + 10000 'get the BCD of the value read and add 10000 to get the leading 1

This returns 11030 rather than 110.30 but for checking if radio is tuned correctly works fine as I also remove the decimal from the frequency to be tuned by multiplying by 100, or you could divide the nav1freq result by 100 to get the decimal place 110.30

regards

Gray

Link to comment
Share on other sites

This is the code that I'm using, like I said, I've just modified the example that came with it, and that number is what was in the messagebox.

Dim smith() As Byte
ReDim smith(5)
Dim dwResult As Long


If FSUIPC_Read(&H350, 5, VarPtr(smith(1)), dwResult) Then
    If FSUIPC_Process(dwResult) Then
    res = smith(1) & smith(2) & smith(3) & smith(4) & smith(5)
    MsgBox res

    End If
End If

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
 Share

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