August 22, 200322 yr As I'd like my gauges to work both for FS2002 and FS2004, do you know a way to get the current FS version number?Some things work differently in FS2002 and FS2004, so the gauges need to know what version of FS is running.Eric My Web Site
August 24, 200322 yr Hi Eric,Here's some code I developed for FSConnect:int GetFSInfo(PUINT VerHi, PUINT VerLo, char *pExeName) { char filename[255]; DWORD dummy, InfoSize; PVOID lpInfo; VS_FIXEDFILEINFO *lpBuff; UINT BuffLen; int res; GetModuleFileName(NULL, filename, 254); InfoSize = GetFileVersionInfoSize(filename, &dummy); if (InfoSize < 1) return errNoFSVersion; lpInfo = VirtualAlloc(NULL, InfoSize, MEM_COMMIT, PAGE_READWRITE); if (lpInfo == NULL) return errNoFSVersion; res = GetFileVersionInfo(filename, 0, InfoSize, lpInfo); if (res == 0) return errNoFSVersion; res = VerQueryValue(lpInfo, "", (void **)&lpBuff, &BuffLen); if (res == 0) return errNoFSVersion; *VerHi = lpBuff->dwProductVersionMS; *VerLo = lpBuff->dwProductVersionLS; VirtualFree(lpInfo, 0, MEM_RELEASE); strcpy(pExeName, strrchr(filename, '') + 1); return 0;}Cheers,Russ Dirks
August 24, 200322 yr Thanks !!It looks quite tricky, but I think I can understand the code.Eric My Web Site
August 25, 200322 yr You can just do GetModuleFileName(NULL, filename, 254);And look at extracted file name. If it ends with fs9.exe - this is 2004 :)
Create an account or sign in to comment