LuisDeSa Posted June 8, 2004 Report Posted June 8, 2004 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
Pete Dowson Posted June 8, 2004 Report Posted June 8, 2004 I got a "developer key" from Pete There's no such thing really. There are application keys, which are in the name and details of the program, and user keys, which provide unrestricted access to all the facilities in FSUIPC as well as all access by applications. but debugging is very difficult as I need to run a full compiled version for FSUIPC to accept my application's requests. This is why most all developer's use a user registered version of FSUIPC whilst developing -- this helps offset the work involved in developing and maintaining the SDK, and in providing unlimited support. Most all the facilities in the SDK have been added directly as a result of developer requests. Sorry, I don't know VB sufficiently to help with the specific question -- it looks very odd to me! I hope other VB rogrammers can help. Regards, Pete
LuisDeSa Posted June 8, 2004 Author Report Posted June 8, 2004 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
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