简体   繁体   English

如何在应用程序中托管资源管理器上下文菜单?

[英]How to host explorer context menu in app?

I have been developing an app with SharpShell Context menu handler that adds and removes certain functions to the explorer context menu. 我一直在开发带有SharpShell上下文菜单处理程序的应用程序,该应用程序可以向资源管理器上下文菜单添加和删除某些功能。 I am trying to create an interface so that the user can choose what to add depending on what is currently available but i cannot figure out how to display the native explorer context menu in the UI. 我正在尝试创建一个界面,以便用户可以根据当前可用的内容选择要添加的内容,但是我无法弄清楚如何在UI中显示本机资源管理器上下文菜单。 The app is written in VB.net but i can translate C#. 该应用程序是用VB.net编写的,但我可以翻译C#。 Any help would be appreciated. 任何帮助,将不胜感激。

You need to iterate over Windows Registry to get existing items and need to update these registry keys to update the menu item. 您需要遍历Windows注册表以获取现有项,并且需要更新这些注册表项以更新菜单项。

Following registry keys are available: 可以使用以下注册表项:

  1. When you right click in blank area a folder: Computer\\HKEY_CLASSES_ROOT\\Directory\\shell 在空白区域中右键单击时,文件夹为: Computer\\HKEY_CLASSES_ROOT\\Directory\\shell

  2. Look for shell folder under your file extension registry to add open with programs. 在文件扩展名注册表下查找shell文件夹以添加打开程序。

  3. Look for ContextMenuHandlers 寻找ContextMenuHandlers

Check this guide on CodeProject. 在CodeProject上查看本指南

Check this guide on Microsoft. 在Microsoft上查看此指南

C# wrapper is also available C#包装器也可用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM