问题描述
我希望我的程序与自定义文件类型相关联,以便单击该类型的文件将使用我的程序打开它.
I want my program to be associated with a custom file type so that clicking on a file of that type will open it with my program.
我已经看到我可以通过以下方式做到这一点:属性->发布->选项->文件关联.但我不知道应该输入什么作为 ProgID.
I've seen I can do that by: Properties->Publish->Options->File associations. But I don't know what I should enter as ProgID.
从 维基百科 看来这是一个很长的数字(是否有特定的选择方法?).从答案这里看来,这就是我想要的一切.
From Wikipedia it seems it's some long number (is there a specific way of choosing it?). From an answer here it seems it's just anything I want.
推荐答案
只需启动 regedit.exe,看看其他程序是如何做到的.progid 列在 HKEY_CLASSES_ROOT 中.您看到的列表中文件扩展名键的(默认)值是与扩展名关联的 progid.一些常见示例:
Just fire up regedit.exe and see how other programs do it. The progids are listed in the HKEY_CLASSES_ROOT. The (Default) value of a filename extension key in the list you see there is the progid associated with the extension. Some common samples:
- .dll = "dllfile"
- .exe = "exefile"
- .ico = "icofile"
- .txt = "txtfile"
你看到了模式.不是要求它看起来像这样,只是一个约定.YourCompany.YourFileType"也很好,因为它具有更具描述性和避免名称冲突的优点.
You see the pattern. It isn't required that it looks like this, just a convention. "YourCompany.YourFileType" is fine as well with the advantages of it being more descriptive and avoiding name collisions.
这篇关于我应该在 VS2010 的文件关联对话框的 ProgID 字段中输入什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!