Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello once again!

I have a little trouble sending messages to FS, realy odd...

What happens is that the messages appears fine in FS, but each time it's updated (using a VB timer) it's changing style, so somtimes it's red and scrolling,

somtimes it's white and not scrolling, sometimes it's red not scrolling and somtimes it's white and scrolling. I cannot understand why it's a "random" style?

As you can se here in my code, everything should be correct for a standard "NON SCROLLING MESSAGE" ?

Function paxBoarding(pax)

    If dwResult = "0" Then
        boardedPax = boardedPax + 1
        If boardedPax <> pax Then

        main.logg.AddItem (boardedPax)
        If FSUIPC_WriteS(&H3380, 128, "Aircraft is boarding: " & boardedPax & " of " & pax & " passangers has boarded.", dwResult) And FSUIPC_Write(&H32FA, 2, VarPtr("0"), dwResult) And FSUIPC_Write(&H1274, 2, VarPtr("0"), dwResult) Then FSUIPC_Process (dwResult)

        Else

        main.logg.AddItem ("Boarding klart! " & boardedPax & " passagerare ombord")
        main.checkForFSTimer.Enabled = True

        End If
    End If

End Function

Please some VB-guru, help me solve this problem! :(

Posted

What happens is that the messages appears fine in FS, but each time it's updated (using a VB timer) it's changing style, so somtimes it's red and scrolling,

somtimes it's white and not scrolling, sometimes it's red not scrolling and somtimes it's white and scrolling. I cannot understand why it's a "random" style?

As you can se here in my code, everything should be correct for a standard "NON SCROLLING MESSAGE" ?

I don't know VB, but don't "" normally enclose a string? If so, then all these are wrong:

If dwResult = "0"

FSUIPC_Write(&H32FA, 2, VarPtr("0"), dwResult)

FSUIPC_Write(&H1274, 2, VarPtr("0"), dwResult)

A string "0" is NOT the same as an integer which is zero, nor (for 32FA or 1274 a 2-byte (16 bit) value which is 0! "0" is certainly not 0!

Why are you writing to 1274? That is an FS menu option. I'd delete that part if I were you, in any case. It isn't part of this facility.

And here:

If FSUIPC_WriteS(&H3380, 128, "Aircraft is boarding: " & boardedPax & " of " & pax & " passangers has boarded.", dwResult)

it is very inefficient to write 128 bytes when the string is a lot shorter than that, and may cause your program to crash if the undeclared bytes are not in accessible memory.

Do you have any VB programming books you can learn a little more about it from?

Regards

Pete

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.