Jump to content
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

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
Guest _ak

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...