Jump to content
The simFlight Network Forums

Recommended Posts

Posted

After doing all my programming projects in VB so far,

I now switched to VB.NET

Is there any good sample application project available where I can study how offsets are read or written correctly in VB.NET ?

Thanks in advance

Posted

Is there any good sample application project available where I can study how offsets are read or written correctly in VB.NET ?

It isn't my subject, but isn't the VB .Net Shell part of the FSUIPC SDK useful?

Regards,

Pete

  • 5 months later...
  • 2 weeks later...
Posted

Its easy. Once you have connected to read stuff just call these functions:

FSUIPC_Read(offset, size, token, result)
FSUIPC_Process(result)
FSUIPC_Get(token, value)

Offset (ie &H2342) and size are from the SDK and relate to the variable you are trying to read. Value is the actual final value. You need a different token for each variable you want to read.

Multi-reads:

FSUIPC_Read(offset1, size1, token1, result)
FSUIPC_Read(offset2, size2, token2, result)
FSUIPC_Process(result)
FSUIPC_Get(token1, value1)
FSUIPC_Get(token2, value2)

And writes are simply:

FSUIPC_Write(offset, value, token, result)
FSUIPC_Process(result)

Email if you want my .Net dll.

MOST important, remember to declare your variables as the same data type as specified in the SDK. ie if it says integer with length 2 then use int16 data type.

BONUS FUNCTION ( :D :D )

To register your app with FSUIPC

Dim token As Integer
Dim bytecode() As Byte
Dim a As New System.Text.ASCIIEncoding

'Insert your key in this line
bytecode = a.GetBytes("A4729AOCNPVU")

FSUIPC_Write(&H8001, bytecode.Length, bytecode, token, dwresult)

'if Process returns true then success else failed to register
If FSUIPC_Process(dwresult) = True Then
 '...success code
Else
 'failure
End If

Posted

ReadOnly Property COM1() As Integer
        Get
            Return CInt(Hex(myCOM1))
        End Get
End Property

This is how I do it. I have a separate class which reads all the FS data I need on a regular cycle.

myCOM1 is a private vriable of type Int16 and I place the data I get via FSUIPC into myCOM1. This returns the com frequency * 1000 but without the starting 1.

for example if property COM1 returns 2346 then the actual com1 frequency is 123.46

Same works for COM2 and I presume the Nav frequencies altho I do not currently collect them

Hope this helps

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.