如何告诉文件由特定程序打开 [英] how to tell a file to be opened by a specific program

查看:68
本文介绍了如何告诉文件由特定程序打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用vb 2010 express创建了一个程序,该程序创建并保存了包含歌曲的文件.如何告诉文件我的程序在双击时会被特定程序打开...对不起为我的英语爱好者...

i have created a program with vb 2010 express that it creates and saves files that have inside songs.. How to tell to the files that my program saves to be opened by a specific program when they are double clicked... sorry for my english guys ...

推荐答案

如果您正在谈论将这些文件与您的应用程序关联,请执行此操作.

双击解决方案资源管理器中的我的项目"文件夹(您也可以在解决方案资源管理器中单击该项目并选择属性).

将打开一个新的选项卡窗口,左侧的选项卡为应用程序",编译",调试"等),您需要单击发布"选项卡,然后单击选项"按钮.在左侧打开的新窗口中,单击文件关联",在这里您可以为单击一次的应用设置文件关联.

扩展名:必填.与应用程序关联的文件扩展名.
(例如.txt)

说明:必填. Shell使用的文件类型的说明.
(例如,我的应用名称)

progid:必填.唯一标识文件类型的名称.
(例如文本文件)

defaultIcon:必需.指定用于具有此扩展名的文件的图标.
(在图标文本框中单击两次或三遍,直到浏览按钮可见(上面带有省略号的按钮"..."),然后浏览找到您的图标文件(.ico))

然后,在安装您的应用程序后,您打开的任何此类文件都会与您的应用程序一起打开.该文件的路径将作为命令行参数传递到您的应用程序中.这是有关获取有关clickonce应用程序的命令行参数的信息的链接.
processing-command-line-arguments-in-an -offline-clickonce-application [ ^ ]

希望对您有所帮助.
If you are talking about associating these files with your application do this.

Double click on your "My Project" folder in the solution explorer (you can also left click on the project in the solution explorer and choose properties).

A new tab window will open with tabs down the left side (Application, Compile, Debug, etc...) you need to click on the "Publish" tab and then click on the "Options" button. In the new window that opens in the left hand side click "File Associations" this is where you will set your file associations for click once apps.

Extension: Required. The file extension to be associated with the application.
(e.g. .txt )

Description: Required. A description of the file type for use by the shell.
(e.g. My Application Name)

progid: Required. A name uniquely identifying the file type.
(e.g. Text File)

defaultIcon: Required. Specifies the icon to use for files with this extension.
( Click two or three times in the icon text box until the browse button is visible (the button with the ellipsis on it " ... ") and then browse for your icon file ( .ico ) )

Then after your app is installed any files of this type you open will be opened with your application. The path of the file will be passed in to your application as a command line argument. Here is a link with information on getting command line arguments for clickonce applications.
processing-command-line-arguments-in-an-offline-clickonce-application[^]

hope this helps.


这称为文件类型关联.您可以在.NET应用程序中以编程方式进行操作.请参阅以下文章:

VB.NET中的文件关联 [系统文件关联 [ http://www.mentalis.org/soft/class.qpx?id=5 [ ^ ].

—SA
This is called file type associations. You can do it programmatically in your .NET application. Please see these articles:

File Association in VB.NET[^],
System File Association[^],
http://www.mentalis.org/soft/class.qpx?id=5[^].

—SA


这篇关于如何告诉文件由特定程序打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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