如何创建自己的文件类型E.G Doc,Xls,Png [英] How Can I Create My Own File Type E.G Doc, Xls, Png

查看:78
本文介绍了如何创建自己的文件类型E.G Doc,Xls,Png的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我知道如何在VB 2010中创建自己的文件扩展名,比如doc,xls,docx,我可以为我的应用程序保存设置。我曾经保存到注册表的本地机器,但该地方受到限制我不想再使用清单了。我创建的文件必须只能通过我的应用程序打开,而不是通过记事本或文本打开。此外,即使是标准用户也可以访问这些文件的最佳位置。我可以提出自己的加密,但你的加密也会很有帮助。我希望这个尽可能安全。任何想法?

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?

推荐答案

如果您研究了与已注册类型的已注册文件类型相关的系统注册表的结构,您可以轻松地弄清楚它们是如何注册的;这不是太难。这只是您可以找到一些相关VB.NET代码的地方之一:

VB.NET中的文件关联 [ ^ ]。



在CodeProject上,你可以找到更多:

http://www.codeproject.com/search。 aspx?q = VB.NET +文件+%28关联+ OR +类型%29& doctypeid = 5 [ ^ ],

http://www.codeproject.com/search.aspx?q= VB.NET +文件+%28关联+ OR +类型%29& doctypeid = 1%3b5 [ ^ ] 。







并且,正如Richard MacCutchan正确指出的那样(请参阅他的评论问题),您无法阻止任何其他应用程序处理根据您要使用的命名方案命名的文件。此外,这样做会很危险。



我也忘了提到文件关联的注册更适合安装项目。这是您真正需要设置(MSI)的情况之一。原因如下:您需要一种明确的方式来删除您的应用程序;唯一明确的方法是卸载应用程序并删除为其创建的所有关联;否则你会严重污染注册表。



-SA
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[^].



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


这篇关于如何创建自己的文件类型E.G Doc,Xls,Png的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆