Jump to content
The simFlight Network Forums

genebuckle

Members
  • Posts

    19
  • Joined

  • Last visited

genebuckle's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. The UIPC_Visual_Basic example is specifically targeted at VB6, not any of the .Net languages, so it would be relevant. g.
  2. That's correct. I wonder if FS is doing any internal conversion to work with DBCS localization issues. Can someone try that code snippet on a Chinese localized version of FSX? :) The 256 byte buffer would result in a max "string" length of 128 characters/symbols if they're storing the localized DBCS data. Pete, you might want to add that code snippet to the readme file for the VB sample code. For those that want to _write_ data out, this might work: dim destArray(256) as byte dim origString as string dim x as integer origString = "\\I am a UNC\path\name\" for x = 1 to len(origString) destArray(x) = asc(mid(origString,x,1)) ' The syntax on the mid() call might not be right' next x destArray(x+1) = 0 ' terminate with a null ' That code will break apart the string one character at a time and stick it into the byte array - the asc() call is used because you want the _value_ of the character in the byte array. This is simply the reverse of how I did it above. g. [wow, the syntax coloring code lost it's mind.... ;) ]
  3. Your knowledge of BASIC is decades out of date. As far as I'm concerned, so is your opinion of it. Your statement: "I don't like Basic at all, but then I'm a programmer. It is intended for non-programmers." Doesn't sound like an opinion to me, it reads like a slap in the face to people like me, who are professional programmers that use any one of the modern implementations of BASIC in their day jobs. 30+ years ago BASIC was intended as an introductory programming language, much like early dialects of Pascal. It's evolved WAY past that over the intervening years. FYI, here's a great example of a "real" program - http://www.shopbottools.com - They make what is probably the world's most popular CNC routers. The control software is world class and written in *gasp* VB6. Professionals have the option of picking the "right" tool for the job. I'd use C for device drivers, Delphi for GUI apps that don't need to rely on heavy DB access and VB.Net or C# if I'm writing a data-heavy customer facing application. Hobbyists will reach for the tool they know best or can afford to buy. It may not be the perfect choice for the task at hand, but if it meets their needs in the end, who cares? g.
  4. Here's a short bit of stand-alone code that illustrates the correct method of reading string data from FSUIPC. Public Function GetAircraftTitle(ByRef AircraftTitle as String) as Boolean Dim dwResult As Long Dim workArray(256) As Byte Dim idx As Integer If FSUIPC_Read(&H3D00, 256, VarPtr(workArray(1)), dwResult) Then If FSUIPC_Process(dwResult) Then idx = 1 While workArray(idx) <> 0 AircraftTitle = AircraftTitle & Chr(workArray(idx)) idx = idx + 1 Wend GetAircraftTitle = true Else AircraftTitle = "Err:FSUIPC_Process(): " & ResultText(dwResult) GetAircraftTitle = false End If Else AircraftTitle = "Err:FSUICP_Read(): " & ResultText(dwResult) GetAircraftTitle = false End If End Sub This simple function will return the name of the currently selected aircraft. To use it: Dim ACTitle as string if GetAircraftTitle(ACTitle) then ' do whatever with the result passed back in ACTitle else '* display/process the error message based back in ACTitle end if Strings in VB are stored internally as UNICODE or "double-byte" strings. This means that you can't use them to interchange data with code that either doesn't support UNICODE or relies solely on single-byte character arrays for strings. In the case of FSUIPC, strings are treated as simple arrays of 8 bit bytes that are terminated with a literal 0. (think CHR(0)) The FSUIPC_Read() call requests 256 bytes of data starting at the hex offset 0x3D00 - it places the result of that read at the address pointed to (VarPtr()) by the first element of workingArray. (Note that by default, VB6 counts array elements from 1, not 0 as do most other languages. If you want to start from 0, make sure you've got "OPTION BASE 0" at the top of your source file or in the global project configuration.) Always make sure that you never request more data than the destination can hold. You run the risk of crashing your program or making it do really, really strange things. (This is known as a "buffer overflow" and is a Bad Thing) The aircraft name is then built by iterating through the byte array until we hit a NULL character - as noted above, the NULL indicates the end of a string. By making the AircraftTitle parameter "ByRef", it allows an additional path to return data to the calling routine - the ByRef keyword tells the compiler to pass a reference to the variable (its address) instead of the value itself (ByVal). The result of this is that when the calling parameter is modified in the function, the "original" is modified. This code should work in VB.Net as well - just change the instances of "GetAircraftTitle =" to "Return". g.
  5. Skittles: You're going to have problems no matter what if you're using VB4. The minimum you should be using is VB6 with Service Pack 6. You would be _best_ served by download Visual Basic 2010 Express (it's a free download) from MS - assuming of course you'd like to continue to use VB/VB.Net. If you need help, PM me and I'd be happy to help out what whatever you're working on. Pete: Instead of denigrating the guy's choice of development language, you could have just said, "I don't know how to help you, but I'm sure there are others here that could. Can someone with more VB experience than myself give Skittles a hand?" I know that doesn't give you the opportunity to slag on a programming language you know nothing about, but it's the right choice regardless. g.
  6. Thanks for the suggestions Pete. I'm sure I'll find something that meets my needs. I'm importing the data as an aid to help users pick the data they want to work with in a new product I'm working on called Cockpit Interface Master. It allows people to access FlightGear, MSFS, X-Plane, IL2 and Lock On: Modern Air Combat and interact with either DirectX input hardware or Beta Innovations input & output hardware. I figure it would be easier if the user just had to double-click on a line in a grid versus searching the offset PDF and then entering it in by hand. :D g.
  7. Well I'll be... S'cuse me while I put my idiot hat back on. Do you know if you can tell it to put all the available data on a single line instead of breaking it up like it does now? Eg. From this: 0000:0EF2, "Surface wind direction", "U16", 2 bytes Category: "Weather", Expression: "#*360/65536" FS-Version: FS98, FS2000, FS2002, FS2004, FSX, CFS2 to this: 0000:0EF2, "Surface wind direction", "U16", 2 bytes,Category: "Weather", Expression: "#*360/65536",FS-Version: FS98, FS2000, FS2002, FS2004, FSX, CFS2 tnx. g.
  8. Unfortunately there isn't a way to export data from FSI that I've found. I was able to work around it though - I converted the PDF documentation to HTML, clipped everything except the tables and then stuffed that result into Excel. It did the job nicely. Some hand editing was/is needed, but nothing terribly drastic. tnx. g.
  9. Can someone point me to a place where I can find the FSUIPC.FSI database in text, csv format? tnx! g.
×
×
  • 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.