Code Samples: FS Version

From FlightSim

Jump to: navigation, search

Code Sample: Determining which version of FS is running

void GetSimulatorVersion()
{
     WIN32_FIND_DATA ffd; // file information struct
     HANDLE sh;
     char searchPath[MAX_PATH];
     // no need for a directory qualifier because all DLL's run
     // within the simulator's main folder since they run as
     // children of the main simulator executable.
     strcpy(searchPath, "fsx.exe");
     sh = FindFirstFile(searchPath, &ffd);
     if (sh == INVALID_HANDLE_VALUE)
{
strcpy(searchPath, "fs9.exe");
sh = FindFirstFile(searchPath, &ffd);
if (sh == INVALID_HANDLE_VALUE)
{
    simVersion = -1;
}
else
    simVersion = 9;
}
else
    simVersion = 10;
}
Personal tools