I'm new to programming with FSUIPC, and have started a little utility in VB. I'm working with the very helpful VB modules provided in the SDK but have a problem that hopefully is due to a simple error on my part.
I've set up a simple applicate to connect to FSUIPC and read the current Lat/Lon coordinates. I start FS (FS2002 or FS9 - same symptom), place the aircraft at the default field, and then run my app. The app connects to FSUIPC and reports the correct version number. It then tries to read the 8 bytes at location #0560 to get the latitude. In fact, I'm really just using the sample code in the VB readme file. Code is as follows:
Private Sub UpdatePosition()
'
Dim Fake64Bit1, Fake64Bit2 As Currency
Dim dwResult As Long
Dim Longitude, Latitude As Double
'
If Active Then
If FSUIPC_Read(&H560, 8, VarPtr(Fake64Bit1), dwResult) Then
' "Read" proceeded without any problems
If FSUIPC_Process(dwResult) Then
Latitude = Fake64Bit1 * 10000#
Latitude = Latitude * 90# / (10001750# * 65536# * 65536#)
lblLatitude.Caption = Str(Latitude)
Else
lblStatus.Caption = "Processing: " & ResultText(dwResult)
End If
Else
lblStatus.Caption = "Read: " & ResultText(dwResult)
End If
End If
End Sub
What happens is that Fake64Bit1 reports as 'empty'. This is odd, since I thought it had to at least take a value of zero. Can anybody tell me what I'm doing wrong?
Thanks for any assistance you can provide,
Philip.