I hope that use c++ language to read GPS Variables (C:fs9gps) in any aircraft,My code is based on the example of P3D C++/XML Mixed Mode Sample 'CabinComfort' modification,I met two problems:
1.The Sample code only used to one aircraft(The sample is Mooney_Bravo),I hope that in any aircraft.
2.I try to create a separate thread to call execute_calculator_code function, P3D(V3.1 version) after completion of loading always crash. This is my code snippet:
- bool bStart = false;
HANDLE hMyMainThread = NULL;
void My_main(void* pArguments);
void FSAPI module_init(void)
{
if (NULL != Panels)
{
ImportTable.PANELSentry.fnptr = (PPANELS)Panels;
CABINPanelCallbackInit();
bStart = true;
hMyMainThread = (HANDLE)_beginthread(My_main, 0, NULL); //Create a separate thread to call execute_calculator_code function
}
}
void FSAPI module_deinit(void)
{
bStart = false;
WaitForSingleObject(hMyMainThread, 1000);
CABINPanelCallbackDeInit();
}
void My_main(void* pArguments)
{
while (bStart)
{
FLOAT64 att_pitch = 0;
FLOAT64 att_bank = 0;
PCSTRINGZ WaypointAirportICAO;
execute_calculator_code ("(A:ATTITUDE INDICATOR PITCH DEGREES:2, degrees)", &att_pitch, NULL, NULL); //P3D(V3.1 version) after completion of loading always crash
execute_calculator_code ("(A:ATTITUDE INDICATOR BANK DEGREES:2, degrees)", &att_bank, NULL, NULL); //P3D(V3.1 version) after completion of loading always crash
execute_calculator_code("(C:fs9gps:WaypointAirportICAO, String)",NULL,NULL,&WaypointAirportICAO); //P3D(V3.1 version) after completion of loading always crash
Sleep(10);
}
}
Is there a better way, only need .DLL file, without the XML file?
If there is a use of c++ execute_calculator_code function to get GPS Variables (C: fs9gps) example is the best!
thanks,
Yorke