Sorry, I don't know about the mismatch (doesn't the compiler or debugger even tell you which line or variable has such a mismatch?), but your code is really enormously inefficient! Why are you calling FS for each little item of data separately? Please do all the FSUIPC_Reads, then one FSUIPC_Process at the end. The reads and writes cost nothing in PC terms, but every process call is swapping to Flight Sim, processing your requests, then swapping back to you. That's really dreadful! :-(
The whole point of separating the actual request to FS from all the individual items is to enable you to write efficient programs. Think of the Reads and Writes being your shopping list, with the Process call being the check-out.
Pete
I agree, the code is not best... :roll:
I have removed some Process calls now as you see bellow. :wink:
Do you meen like this?
Dim fuel_l_lvl, fuel_l_cap, fuel_w As Long
Call FSUIPC_Read(&HB7C, 4, VarPtr(fuel_l_lvl), dwResult)
Call FSUIPC_Read(&HB80, 4, VarPtr(fuel_l_cap), dwResult)
Call FSUIPC_Read(&HAF4, 2, VarPtr(fuel_w), dwResult)
Call FSUIPC_Process(dwResult)
Dim fuel_left As Long
fuel_left = fuel_l_cap * ((fuel_l_lvl * 100 / (128 * 65536)) / 100) * (fuel_w / 256) * 0.4535924
' Fuel on board --> Center tank
Dim fuel_c_lvl, fuel_c_cap As Long
Call FSUIPC_Read(&HB74, 4, VarPtr(fuel_c_lvl), dwResult)
Call FSUIPC_Read(&HB78, 4, VarPtr(fuel_c_cap), dwResult)
Call FSUIPC_Process(dwResult)
Dim fuel_center As Long
fuel_center = fuel_c_cap * ((fuel_c_lvl * 100 / (128 * 65536)) / 100) * (fuel_w / 256) * 0.4535924
' Fuel on board --> Right tank
Dim fuel_r_lvl, fuel_r_cap As Long
Call FSUIPC_Read(&HB94, 4, VarPtr(fuel_r_lvl), dwResult)
Call FSUIPC_Read(&HB98, 4, VarPtr(fuel_r_cap), dwResult)
Call FSUIPC_Process(dwResult)
Dim fuel_right As Long
fuel_right = fuel_r_cap * ((fuel_r_lvl * 100 / (128 * 65536)) / 100) * (fuel_w / 256) * 0.4535924
But i'm still getting the same error... :(