Sign in to follow this  
Guest _ak

FS version

Recommended Posts

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

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

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

Share this post


Link to post
Share on other sites

Thanks !!It looks quite tricky, but I think I can understand the code.Eric

Share this post


Link to post
Share on other sites

You can just do GetModuleFileName(NULL, filename, 254);And look at extracted file name. If it ends with fs9.exe - this is 2004 :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this