Jump to content
The simFlight Network Forums

Can't get text to show correctly...


Recommended Posts

Hi Pete,

I'm trying (as a beginner) to do some programming for FS using your fantastic FSUIPC module (of which I have a registered version.)

While eveything else seems to be working fine, I can't get text to display properly in the scroll bar that goes across the top of the screen in FS2K4. All I get is nonsense scrolling across the top...

The short piece of code is:

strMessageB = ""

disString = "Distance to " & DestICAO & ": " & Format(Distance, "#0.0 nm")

For iCount = 1 To Len(disString)

strMessageB = strMessageB & ChrBAsc(Mid(disString, iCount, 1)))

Next iCount

strMessageB = strMessageB & Chr(0)

myInt = -1

If FSUIPC_Write(&H3380, 128, VarPtr(strMessageB), dwResult) Then

If FSUIPC_Write(&H32FA, 2, VarPtr(myInt), dwResult) Then

If FSUIPC_Process(dwResult) Then

End If

End If

End If

If you have a spare moment, please could you see if you can spot any silly mistakes I've made in the above.

Kind regards,

Alex Berry,

Edinburgh.

Link to comment
Share on other sites

While eveything else seems to be working fine, I can't get text to display properly in the scroll bar that goes across the top of the screen in FS2K4. All I get is nonsense scrolling across the top

Sorry, I don't know Visual Basic enough to advise you accurately on this. The usual problems VB programmers have are (a) wide (16-bit) characters being used instead of the normal standard ASCII as understood by FS, and (b) not passing the pointers to strings, but values instead.

It looks like the former may be taken care of by your preparation loop (though I don't really know this, I should add), but I thought the writing of strings from VB was best done by the use of the "FSUIPC_WriteS" variant some kind person added to the VB part of the SDK? Have you tried that? It may be that the declaration of the FSUIPC_Write function is de-referencing your string pointer.

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.