Jump to content
The simFlight Network Forums

LuisDeSa

Members
  • Posts

    48
  • Joined

  • Last visited

Posts posted by LuisDeSa

  1. Hi Paul,

    Thank you very much for the explanation. I am using the DLL in SBuilder (scenery creation programme) and I get an error in the situation that I will try to explain:

    My programme has an option to show the FS aircraft on the Sbuilder display. When the user sets this option and until he disconnects the option, the programme displays the aircraft position at regular intervals (set by a timer). This is the code for the timer event:

    Try

    FSUIPCConnection.Process()

    AircraftLatitude = CDbl(LatAircraft.Value)

    AircraftLatitude = AircraftLatitude * 90.0 / (10001750.0 * 65536.0 * 65536.0)

    AircraftLongitude = CDbl(LonAircraft.Value)

    AircraftLongitude = AircraftLongitude * 360.0 / (65536.0 * 65536.0 * 65536.0 * 65536.0)

    Catch ex As Exception

    MsgBox("Error communicating with FSUIPC!", MsgBoxResult.Ok)

    AircraftVIEW = False

    ShowAircraftMenuItem.Checked = False

    Me.Timer2.Enabled = False

    Exit Sub

    End Try

    UpdateDisplay()

    This runs fine except if the user closes FS. Then SBuilder (in debug mode) reports an error in the DLL or it crashes in normal operation. I could start the shown routine with:

    Try

    FSUIPCConnection.Close()

    FSUIPCConnection.Open()

    FSUIPCConnection.Process()

    ...

    but this does not look good as the timer interval can be very short (100ms or so depending on the settings of the user of my programme).

    Many thanks for any tip,

    Regards,

    Luis

  2. Hello,

    There was a bug in my implementation :mrgreen: . For the benefict of other users here is a correction:

    Public Function fsUIPCSetLatitude(ByVal Latitude As Double) As Integer

    In the fsUIPCSetLatitude function the variable Latitude can not be passed by reference (by reference is default in VB). The crash was in my application because the function modified the Latitude.

    Regards and many thanks to Pete for providing an application key for SBuilder, Luis

  3. Hello,

    I wonder if any VBasic programmer can help me in writing the code for my applycation to set the aircraft position through FSUIPC. I got a "developer key" from Pete but debugging is very difficult as I need to run a full compiled version for FSUIPC to accept my application's requests.

    My application is scenery generation programme and I only need to read and to write the aircraft lat/lon. I followed the examples in the FSUIPC SDK and I can read the aircraft position. But when I try to set the aircraft position there is an overflow and my application crshes.

    Following is the routines to read (which works fine) and to write (which does not) the latitude. Any comment would be most apreciated.

    Regards, Luis

    Public Function fsUIPCGetLatitude(Latitude As Double) As Integer

    Dim Fake64Bit As Currency

    Dim dwResult As Long

    fsUIPCGetLatitude = 0

    If FSUIPC_Read(&H560, 8, VarPtr(Fake64Bit), dwResult) Then

    If FSUIPC_Process(dwResult) Then

    Latitude = Fake64Bit * 10000#

    Latitude = Latitude * 90# / (10001750# * 65536# * 65536#)

    Else

    fsUIPCGetLatitude = 1

    End If

    Else

    fsUIPCGetLatitude = 1

    End If

    End Function

    Public Function fsUIPCSetLatitude(Latitude As Double) As Integer

    Dim Fake64Bit As Currency

    Dim dwResult As Long

    fsUIPCSetLatitude = 0

    Latitude = (Latitude / 90#) * (10001750# * 65536# * 65536#)

    Fake64Bit = Latitude / 10000#

    If FSUIPC_Write(&H560, 8, VarPtr(Fake64Bit), dwResult) Then

    If FSUIPC_Process(dwResult) Then

    Else

    fsUIPCSetLatitude = 1

    End If

    Else

    fsUIPCSetLatitude = 1

    End If

    End Function

  4. Hello Pete,

    I was not sufficient clear in my message. I am very sorry. I am the author of the programme. I could not find your email to ask for a key. In fact I am using another module to read Aircraft position (Latitude and Longitude). Then I display the aircraft in my programme console. The other funcionality that I would like to implement is to force the FS Aircraft to go the area that my programme is working (this funcionality does not work with the module that I am using).

    In conclusion I would like to know if I could integrate your software in my programme. I only need the functions:

    set aircraft lat

    set aircraft lon

    read aircraft lat

    read aircraft lon

    and if possible

    set aircraft altitude

    read aircraft altitude

    Kind Regards, Luis

×
×
  • 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.