Jump to content
  • Advertisement
Sign in to follow this  
mrbreakit

Application Data Folder

This topic is 5153 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to store my game options and saves in the Application Data folder in windows. (2K/XP: c:/documents and settings/user/Application Data). I looked at VC documentation and I am still confused. What is the difference between SHGetSpecialFolderPath and SHGetSpecialFolderLocation ? Both functions take an HWND as a param. MSDN: Handle to the owner window the client should specify if it displays a dialog box or message box. In what situation would the function display a message box? Also, if I get the app data folder under windows 95/98 what path will I get?

Share this post


Link to post
Share on other sites
Advertisement
i may be able to help...

If you want to get the current directory u can do this...


int i;
char CurrentDirPath[260];
char OrigDirPath[260];
GetModuleFileName(NULL, &CurrentDirPath[0], sizeof (CurrentDirPath));

for( i = strlen(&CurrentDirPath[0])-1 ; i >= 0 ; i-- )
{
if( CurrentDirPath == '\\' ) //find the last backslash in the
{ //module filename
CurrentDirPath[i+1]=NULL; //set the byte after it to NULL to
break;
}
}
strcpy(&OrigDirPath[0], &CurrentDirPath[0]);



Then if you want to move to a specific dir in the current directory u can just use some strcat() functions to build teh dir path, dont forget that in order to have a slash '/'in a string u have to use '//'

hope this helps

ace

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by ace_lovegrove
Then if you want to move to a specific dir in the current directory u can just use some strcat() functions to build teh dir path, dont forget that in order to have a slash '/'in a string u have to use '//'


that's for '\' not '/'

Matt

Share this post


Link to post
Share on other sites
Well according to the MSDN, SHGetSpecialFolderPath() returns the path in a LPCSTR where as SHGetSpecialFolderLocation() returns a ITEMIDLIST. But the function you really want is SHGetFolderPath()—It is the superset of SHGetSpecialFolderPath().

To use SHGetFolderPath() on machines that don't have version 5.0 of shell32.dll (i.e., don't have IE5 or better) you will need to distribute SHFolder.dll with your application. A SHFolder redistributable is available in the Platform SDK.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!