Vista & Creating a File in "Program Files"
Hello everyone. I have recently been developing a program, and just the other day I completed it. I developed this program on Windows Vista Home Basic. When I ran the program it worked perfect. I compiled my program and made it an installer. When my program runs inside the "Program Files" folder, it returns this error: "Run-Time error '75': Path/File Error".
This is due to my program creating a "settings.txt" on the app startup. How do i fix this?
thankyou
Re: Vista & Creating a File in "Program Files"
The basic rule seems to be that only a recognized installer or elevated process can write to "Program Files."
The recommended workaround is to relocate settings files, data files, etc. into "Common Files" located via Microsoft Shell Controls and Automation (Shell32.dll) which is an ActiveX DLL or else ShFolder.dll which is a standard DLL. You should use these "lookups" because the folders are in different paths for different machines and OSs.
Per-user settings should be in a separate file located under "Application Data" and this should also be requested of the OS in the same manner.
For "Common Files" ask for ssfCOMMONDATA (or CSIDL_COMMON_APPDATA).
For "Application Data" ask for ssfAPPDATA (or CSIDL_APPDATA).
Note: there is also a "Local Settings\Application Data" folder CSIDL_LOCAL_APPDATA for settings that stick to one machine in the event roaming profiles are used for users.
To properly use these filesystem locations you are supposed to create a subdirectory for your "company name" and under that another for your "application name." Then put your settings or data under that.
Note that any working "document" files that are meant to be found and manipulated by the user (i.e. via Explorer) should be placed into CSIDL_PERSONAL ("My Documents") or CSIDL_COMMON_DOCUMENTS ("All Users\Documents").
Re: Vista & Creating a File in "Program Files"
Re: Vista & Creating a File in "Program Files"
Using the CSIDL locators works on XP as well, so you don't need to fiddle around.
Quote:
You should also refrain from hard-coded assumptions about the known folder paths. For example, on Windows XP Professional 64-bit Edition and Windows Vista x64, the program files path is C:\Program Files (x86) for 32-bit programs and C:\Program Files for 64-bit programs. These known paths are changed from Windows XP, and users can reconfigure the location of many of these folders and even locate them on different drives. So, always use the CSIDL constants to avoid confusion and potential problems. Windows Setup understands these known folder locations and will move the data when upgrading the operating system from Windows XP; in contrast, use of non-standard locations or hard-coded paths may well fail after an OS upgrade.
File Access as a Standard User
Re: Vista & Creating a File in "Program Files"
These are my sources for interacting with Vista's new security technologies. They should be very helpful.
http://msdn.microsoft.com/msdnmag/is...C/default.aspx
http://technet2.microsoft.com/Window....mspx?mfr=true
Re: Vista & Creating a File in "Program Files"
Thanks RobDog888 and dilettante, I have added your links and information to the post:
Modifications Required for VB6 Applications to Work on Vista