|
-
Apr 4th, 2007, 06:16 PM
#1
Thread Starter
Lively Member
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
-
Apr 4th, 2007, 08:38 PM
#2
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").
-
Apr 4th, 2007, 08:42 PM
#3
Re: Vista & Creating a File in "Program Files"
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 4th, 2007, 08:57 PM
#4
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.
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
-
Apr 4th, 2007, 09:33 PM
#5
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
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 5th, 2007, 09:22 AM
#6
Hyperactive Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|