Associate a File To a Application

你说的曾经没有我的故事 提交于 2019-12-12 05:39:03

问题


I'm building two programs, a text editor and a zipper, but in this two programs I want to associate a file type to they, but how can I do this? Thanks.


回答1:


You need to edit the registry: http://support.microsoft.com/kb/257592
You'll probably want to use regedit to see previous file associations, to make sure you don't mess up.

c# registry basics




回答2:


I know this is an old thread, but I don't think you should be messing around with the registry like that. Especially not since ClickOnce and other deployment wizards have implemented a built-in capability to make a file-association. You can find this in Solution Explorer -> Project Properties -> Publish tab -> Options button -> File-associations tab. Here you have the ability to register a file-type using a custom icon, description of the file, and a program identification.

If you want to take a step ahead, you can do this with Single-instance applications as well. I did this in a tutorial project on my website: DrawIt In the project I'm setting up a TCP-listener in the first instance and in the second, third, ... instance I connect a TCP-client and send the ActivationArguments to the first one.

The most important code blocks are in the file Program.cs and void Start_server in Hoofdscherm.cs.



来源:https://stackoverflow.com/questions/1734192/associate-a-file-to-a-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!