如何将子菜单项添加到 Windows 资源管理器上下文菜单?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39734/
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
How to add submenu items to the Windows Explorer context menu?
提问by Santiago Corredtheitroada
I can create a menu item in the Windows Explorer context menu by adding keys in the registry to HKEY_CLASSES_ROOT\Folder\shell.
我可以通过将注册表中的键添加到HKEY_CLASSES_ROOT\Folder\shell来在 Windows 资源管理器上下文菜单中创建一个菜单项。
How can I create submenu items to the just created menu item?
如何为刚刚创建的菜单项创建子菜单项?
采纳答案by Aardvark
I believe anything non-trival you'll have to create a Context Menu Handler.
我相信任何重要的事情你都必须创建一个Context Menu Handler。
You'll have to create a COM object that will create the menus and carry out the commands as they're clicked. I've only done this using C++ and COM. I'm not sure if there are easier ways to do this.
您必须创建一个 COM 对象,该对象将创建菜单并在单击时执行命令。我只使用 C++ 和 COM 完成了这项工作。我不确定是否有更简单的方法来做到这一点。
回答by HiDiHo
Use SubCommands "SubCommands"="[NameOfMenu]"
使用子命令 "SubCommands"="[NameOfMenu]"
Example for creating submenu for .TS files:
为 .TS 文件创建子菜单的示例:
[HKEY_CLASSES_ROOT\SystemFileAssociations\.ts\shell\Encoding]
"MUIVerb"="Encoding video"
"SubCommands"="Encodex265Fade;EncodeTS2;watched"
"icon"="imageres.dll,-149"
"Position"=-
"MultiSelectModel"="Single"
"NeverDefault"=""
;"ExtendedSubCommandsKey"="Encode\Fadein"
;"Icon"="C:\Program Files (x86)\CloudMe\CloudMe\favicon.ico"
More info: https://msdn.microsoft.com/en-us/library/windows/desktop/hh127431(v=vs.85).aspx
更多信息:https: //msdn.microsoft.com/en-us/library/windows/desktop/hh127431(v=vs.85).aspx