windows 将我的程序添加到右键菜单
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6179562/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
adding my program to right-click menu
提问by Foresp
with right click menu, I mean this: I dont really know what its called, but i hope its right click menu.
使用右键菜单,我的意思是:我真的不知道它叫什么,但我希望它的右键菜单。
When I google for queries like title of this question, i get nothing. some tutorials that shows how can i add an .exe to that list etc. but I'm looking for some tutorial that will teach me how to handle that data, what that right click menu will return me, etc. But sadly, I found nothing. So here I am, asking...
当我用谷歌搜索这个问题的标题之类的查询时,我一无所获。一些教程展示了如何将 .exe 添加到该列表等。但我正在寻找一些教程来教我如何处理该数据,右键单击菜单将返回什么等等。但遗憾的是,我发现没有。所以我在这里,问...
How can I add my program to that list, and when I do what it returns to me, are there any tutorial for this on the internet ?
如何将我的程序添加到该列表中,当我执行返回给我的操作时,互联网上是否有相关教程?
采纳答案by Jan-Peter Vos
You would add some keys to the registry to have your program in that list. You can find more about it here: http://www.howtogeek.com/howto/windows-vista/add-open-with-notepad-to-the-context-menu-for-all-files/
您可以向注册表中添加一些键,以使您的程序出现在该列表中。您可以在此处找到更多相关信息:http: //www.howtogeek.com/howto/windows-vista/add-open-with-notepad-to-the-context-menu-for-all-files/
In the example they use Notepad.exe %1
that will basicly do the same as calling Notepad.exe c:\myFile.txt
from the run window.
在他们使用的示例中Notepad.exe %1
,基本上与Notepad.exe c:\myFile.txt
从运行窗口调用相同。
You can read the parameter in the main(string[] args)
method. It will pass it as contents of the args
parameter. You can also get that value anywhere else in your application using the Environment.GetCommandLineArgs()
method.
您可以读取main(string[] args)
方法中的参数。它将作为args
参数的内容传递。您还可以使用该Environment.GetCommandLineArgs()
方法在应用程序的任何其他位置获取该值。
回答by james_bond
You have to deal with Windows registry, take a look at this link: http://www.codeproject.com/KB/cs/appendmenu.asp
你必须处理 Windows 注册表,看看这个链接:http: //www.codeproject.com/KB/cs/appendmenu.asp
[Edit]
[编辑]
Link to article has changed:
文章链接已更改:
http://www.codeproject.com/Articles/10104/Add-a-context-menu-to-the-Windows-Explorer
http://www.codeproject.com/Articles/10104/Add-a-context-menu-to-the-Windows-Explorer
回答by muma
What you want is a contextmenu. Google "contextmenu" C#. than you should find, what you want to find. For example: http://msdn.microsoft.com/en-us/library/aa984254(v=vs.71).aspx
你想要的是一个上下文菜单。谷歌“上下文菜单”C#。比你应该找到的,你想找到的。例如:http: //msdn.microsoft.com/en-us/library/aa984254(v=vs.71).aspx