Darren66 Posted October 14, 2003 Posted October 14, 2003 I want to write a piece of code that creates a file in the windows directory when the user performs a certain action. The problem I have is not creating the file but correctly referencing the windows path. What is the best way to do this? I'm hoping that there is something similar to Application.Path except for the windows directory.. If anyone can point me in the right direction it would be appreciated. Thanks Quote
*Experts* Volte Posted October 14, 2003 *Experts* Posted October 14, 2003 Environment.SystemDirectoryreturns the System32 directory, so you can use System.IO.Directory.GetParent(Environment.SystemDirectory)to retrieve it. However, you should not create files in that directory unless you need to. What file are you creating? Quote
Darren66 Posted October 14, 2003 Author Posted October 14, 2003 I read a forum post here (I don't have the link to hand) which discussed the various methods for making an application inactive after 30 days if the user hasn't entered an unlock code. One method that was suggested was creating a hidden file in the windows directory which could be used to indicate whether the program was paid for or not, rather than using registry entries. My intention was to do something similar... Quote
*Experts* Volte Posted October 14, 2003 *Experts* Posted October 14, 2003 I would recommend against that - creating files in the Windows directory without telling the user is not a good idea (at least in my opinion). Plus, with a file-system monitor tool like FileMon, it's easy to find out its location. I suggest you just keep a heavily encrypted registry key that is rather difficult to break. Remember, 30-day trial versions are not really effective shareware, since it is generally fairly easy to reset the counter to 0, or even just uninstall and re-install your program. If you really want effective shareware, you need to actually remove functionality from the program. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.