创建自己的文件扩展名

编程入门 行业动态 更新时间:2024-10-27 17:20:29
本文介绍了创建自己的文件扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在vb中创建自己的文件扩展名.

How to create own file extension in vb. which is open in a unique application.

推荐答案

在此CodeProject文章中对此进行了解释: VB.NET中的文件关联 [ ^ ]. 我认为本文并不完美,但是您只需要了解系统注册表中规定的内容,即可向Shell提供有关新引入的文件类型"及其与运行该应用程序所需的应用程序的关联所需的信息.被识别为您类型的文件. 至于打开"文件之类的操作;这是您需要在应用程序中编码的东西.命令行管理程序仅在命令行中以您在注册表中指定的格式为您提供文件名.可能很简单 This is explained in this CodeProject article: File Association in VB.NET[^]. I think the article is not perfect, but you only need to learn what is prescribed in the system registry to provide the Shell the required information on your newly introduced "file type" and its association with the application you need to run to work with the files recognized as the files of your type. As to the operations like "open" the file; this is something you need to code in your application. The Shell only gives you the file name in a command line in a format you prescribe in the Registry. It could be as simple as MyApplication.EXE myDataFileName.NewFileType

或类似

MyApplication.EXE /c /d -verbose /input:myDataFileName.NewFileType -no_warning /log:logfile.txt

您的应用程序应解析命令行并采取相应措施. 您可以使用我在文章中提供的命令行实用程序: 基于枚举的命令行实用程序 [ ^ ]. 您也可以自己完成此操作,因为命令行以两种方式传递给您的应用程序:1)作为传递给入口点方法的两个参数(通常为"Main"),2)作为属性System.Environment.CommandLine,请参阅: msdn.microsoft/en-us/library/system.environment. commandline.aspx [ ^ ].

—SA

Your application should parse the command line and act accordingly. You can use the command line utility I offer in my article: Enumeration-based Command Line Utility[^]. You can also do it by yourself, because the command line is passed to your applications in a couple of ways: 1) as two parameters passed to the entry point method (usually "Main"), 2) as the property System.Environment.CommandLine, please see: msdn.microsoft/en-us/library/system.environmentmandline.aspx[^].

—SA

更多推荐

创建自己的文件扩展名

本文发布于:2023-10-14 19:10:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1491949.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自己的   文件扩展名

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!