操作 Windows 资源管理器上下文菜单
我目前正在框架 3.5 SP1 中使用 WPF 编写应用程序,我需要将我的功能扩展到 Windows 资源管理器上下文菜单,就像 Winzip 或 Winrar 或其他任何人在用户右键单击文件或文件夹时所做的那样。
我查了很多资料,有人说用Registry,我试过后觉得很不灵活。因为我需要上下文菜单中的子菜单以及图标。
我发现的另一种方法是 shell 编程,它更令人讨厌,但比注册表方法更有潜力。
Shell编程需要COM编程知识,需要时间学习。
对于我发现的所有关于修改Windows资源管理器上下文菜单的文章,它们大多发表于2003年、2005年等,这是5年前的事了,我的意思是,经过5年的发展,有没有任何新技术可以在当前的情况下实现这一点.net 框架,如 3.5 SP1 或 4.0 使用 c#?
谢谢。
I am currently writing application with WPF in framework 3.5 SP1, and I need to extend my functionality to Windows Explorer context menu, like how Winzip or Winrar or anyone else did when user right click on a file or folder.
I did a lot of study, some said use Registry, which after I tried, is quite inflexible. Because I need sub menu in my context menu, and also icons.
Another approach I found, is the shell programming, which is even more nasty, but have much much more potential than the registry method.
Shell programming require COM programming knowledge, which need time to learn.
For all the articles I found about modifying windows explorer context menu, they are mostly published in year 2003, 2005 etc, it's 5 years ago, I mean, after 5 years of development, is there any new technology that can make this possible in current .net framework like 3.5 SP1 or 4.0 using c#?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要在 Windows 资源管理器上下文菜单中添加附加条目,您需要在 Windows 注册表中的 HKEY_CLASSES_ROOT\Folder\shell 中添加两个子项,
这些项是:
Folder\shell\MyProduct :此项的值将显示为文本新的 Windows 资源管理器上下文菜单项。您还可以通过向键 1 添加值并将其命名为“Icon”,然后将图标的路径设置为值来将图标添加到上下文菜单项。
Folder\shell\MyProduct\command:设置要启动的应用程序的路径。
以下是更多详细信息和示例 C# 代码的链接:
http://newapputil.blogspot。在/2016/12/adding-new-item-to-context-menu-of.html
To make an additional entry in windows explorer context menu You would need to add two sub keys in windows registry at HKEY_CLASSES_ROOT\Folder\shell
These keys are:
Folder\shell\MyProduct : Value of this key will be shown as text in the new windows explorer context menu item. You can also add a icon to the context menu item by adding a value to the key 1 and name it "Icon" then set path to icon as value.
Folder\shell\MyProduct\command: Set the path of application which you want to launch.
Here is the link for more details and sample C# code:
http://newapputil.blogspot.in/2016/12/adding-new-item-to-context-menu-of.html
将应用程序添加到右键单击每个文件夹
下面介绍了如何在右键单击任何文件夹时将任何应用程序添加到上下文菜单。这样您就不必总是转到“开始”菜单。当您右键单击任何文件夹时,您可以访问该应用程序,就像使用“发送到”一样。
为您编写代码...
编辑:
C# 代码(对于文件夹)
Adding an Application to the Right Click on Every Folder
Here is how to add any application to the Context Menu when you right click on any Folder. This way you do not have to always go to the Start Menu. When you right click on any folder, you can have access to that application, the same as using Sent To.
Writing code for you....
Edit:
code in C# (for folders)