Click here to Skip to main content
15,992,587 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys does anybody know how i can create my own file extensions in VB 2010 like doc, xls, docx, where I can save settings for my application. I used to save to registry's local machine but that place is restricted I don't want to use manifests anymore. The files that i create MUST only be opened via my app, not through notepad or text pad. Also where is the best place to place those files where even a standard user can have access. I can come up with my own encryption, but yours would also be helpful. I want this to be as secure as possible. Any ideas?
Posted
Comments
Richard MacCutchan 17-Mar-14 11:46am    
You cannot prevent anyone from opening your files with other programs, such as notepad etc. If you want your files to be totally secure then don't let the users have access to them.
Sergey Alexandrovich Kryukov 17-Mar-14 12:04pm    
Absolutely correct. I did not see this comment when I started to enter my answer, so I credited you for this point later.
—SA

1 solution

If you studied the structure of the system registry in relation to the registered file types of already registered types, you could easily figured out how they a registered; this is not too hard. This is just one of the places where you can find some relevant VB.NET code:
File Association in VB.NET[^].

On CodeProject along, you could find more:
http://www.codeproject.com/search.aspx?q=VB.NET+file+%28associations+OR+types%29&doctypeid=5[^],
http://www.codeproject.com/search.aspx?q=VB.NET+file+%28associations+OR+types%29&doctypeid=1%3b5[^].

[EDIT]

And, as Richard MacCutchan correctly pointed out (please see his comment to the question), you cannot prevent any other applications from handling the files named according to the naming schema you want to use. Moreover, doing so would be dangerous.

I also forgot to mention that registration of the file associations is more adequate for setup projects. This is one of the cases where you really need setup (MSI). Here is why: you need a clear way of removing your application; and the only clear approach is when you uninstall your application and remove all the associations you created for it; otherwise you would badly contaminate the registry.

—SA
 
Share this answer
 
v8
Comments
vbGoof 17-Mar-14 13:31pm    
Thank you guys, will go and study those examples.
Sergey Alexandrovich Kryukov 17-Mar-14 14:38pm    
Great. Good luck, call again.
Your follow-up questions will be welcome.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900