BoXon Posted August 4, 2008 Report Share Posted August 4, 2008 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! :( Link to comment Share on other sites More sharing options...
Pete Dowson Posted August 4, 2008 Report Share Posted August 4, 2008 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 Link to comment Share on other sites More sharing options...
BoXon Posted August 4, 2008 Author Report Share Posted August 4, 2008 Hi Pete well, the "write" code is just a "copy & paste", but i'll try to change the "0" part. :) Link to comment Share on other sites More sharing options...
Pete Dowson Posted August 4, 2008 Report Share Posted August 4, 2008 well, the "write" code is just a "copy & paste" Copy and paste from someone else's bad code you mean? Regards Pete Link to comment Share on other sites More sharing options...
BoXon Posted August 5, 2008 Author Report Share Posted August 5, 2008 well, the "write" code is just a "copy & paste" Copy and paste from someone else's bad code you mean? Regards Pete Yepp :wink: Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now