Is there a program in Windows in the System32 folder that I can call that returns the Application Data directory, or how should I go about making the program determine where to store Application Data? It is different for many versions of Windows, and with there being more versions of Windows coming up in the future, I cannot just make an array with possible directories because I would need to update that with each Windows release. Please give an informative example of how to detect exactly there the Application Data is to be stored. Thank you.

I believe the environment variable %APPDATA% is set for all reasonable versions of Windows you may be targeting (from Windows 2K and up, I believe). So something like filepath = "%APPDATA%\\folder\\file.txt";

You shouldn't need to call a program. But if you do Start -> Run... -> %APPDATA% it should pop up an Explorer window with the appropriate folder open, if you're curious.

Thank you for this tip. I tried this and it printed %APPDATA% just the same, however, so there must be more to it than this. Also, creating the directory will need to be done by the installer I create, correct?

If you have access to the registry, you can read HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\AppData, as documented here: http://technet.micro...y/cc962614.aspx

If you're creating an installer I'd highly recommend that you use a well-known installer technology rather than trying to roll your own. Visual Studio, for example, can be used to create an MSI file, and it will resolve all of this for you, as well as provide for uninstallation (and also be compatible with remote deployment via e.g. Group Policy).

Edited by mhagain, 23 July 2012 - 08:38 PM.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.