Jump to content
Sign in to follow this  
Guest bartels

Can you read the fs9.cfg directly?

Recommended Posts

Guest bartels

Is there a way to detect the location of the fs9.cfg automatically by C gauges? I can read it with e.g. GetPrivateProfileString if I know the exact path, no problem. But how to get that path? Or, are there global variables that store that "user data" path somewhere?Arne Bartels

Share this post


Link to post
Share on other sites
Guest HartmannH

There's shell variable called "USERPROFILE" which contains the path you need but I'm pretty sure that it only exists in Windows XP so it won't be very helpful.

Share this post


Link to post
Share on other sites
Guest bartels

OK, found it myself:#include ...char appdata[MAX_PATH+1]="";char value[255+1]="";...SHGetSpecialFolderPath(NULL,appdata,CSIDL_APPDATA,FALSE);strcat(appdata,"MicrosoftFS9fs9.cfg"); ...GetPrivateProfileString("PANELS","IMAGE_QUALITY","",value,sizeof(value)-1,appdata);link shell32.lib.Possibly the exename has to be used, not "fs9.cfg" hardwired. If the exe is renamed, the .cfg file uses this new name.Arne BartelsP.S. checked with XP SP2 and W98SE

Share this post


Link to post
Share on other sites
Guest HartmannH

Hey, den kannte ich noch nicht. Vielen Dank :-)

Share this post


Link to post
Share on other sites
Guest bartels

Wildes Suchen hilft manchmal. Erst hatte ich Appdata als Begriff gefunden, bei MSDN fiel mir dann irgendwann "SHGetSpecialFolderPath" vor die F

Share this post


Link to post
Share on other sites
Guest zip

You can also scan the software keys in the Windows registry - I haven't looked but I'm pretty sure that the install folder is in the LOCAL_MACHINE/software hive and the path to the CFG is in the LOCAL_USER/software hive (since each user has a personal copy of the CFG file).That should work with Windows 2000 or Windows XP.

Share this post


Link to post
Share on other sites
Guest bartels

In adition a check if the exe name/cfg name is NOT fs9:#include #include ... char appdata[MAX_PATH+1] = "", exename[MAX_PATH+1] = "", *helper = NULL;... //get full exe pathname GetModuleFileName(NULL,exename,MAX_PATH); //cut path helper=strrchr(exename,''); if(helper) sprintf(exename,"%s",helper+1); //cut .exe suffix helper=strstr(exename,".exe"); if(helper) *helper=0; //get FS9.cfg path, first appdata, then rest SHGetSpecialFolderPath(NULL,appdata,CSIDL_APPDATA,FALSE); sprintf(appdata,"%sMicrosoftFS9%s.cfg",appdata,exename); ...Arne Bartels

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...