简体   繁体   English

在 Windows Explorer 上下文菜单中订购

[英]Order in the Windows Explorer context menu

How can I change the order of the entries in the context menu?(eg for Directories) I need to know how Windows determines the order when showing that so I can control it.如何更改上下文菜单中条目的顺序?(例如,对于目录)我需要知道 Windows 在显示时如何确定顺序,以便我可以控制它。 For example I want to place my custom action at the end of the context menu list例如,我想将自定义操作放在上下文菜单列表的末尾

Thank in advance!预先感谢!

My Google-fu led me to this :我的 Google-fu 引导我这样做

So the sorting is based on the following elements in decision order:所以排序是基于以下元素的决策顺序:

  1. Key priority (eg, txtfile, *, AFSO)关键优先级(例如,txtfile、*、AFSO)
  2. Registry Enumeration order of shellex\contextmenuhandlers with a special case for static verbs always being first shellex\contextmenuhandlers 的注册表枚举顺序,其中 static 动词的特殊情况总是在前
  3. IContextMenu Implementation order IContextMenu 实现顺序

So if there is any contention for position, there is no consistent way for an extension to guarantee their relative position within the menu.因此,如果对 position 有任何争用,则扩展没有一致的方法来保证其在菜单中的相对 position。

Obviously you can't do anything about phase 1. Phase 3 only applies to the verbs implemented in your handler.显然你不能对阶段 1 做任何事情。阶段 3 只适用于在你的处理程序中实现的动词。 That leaves phase 2. The only thing you can do is name your entry under ContextMenuHandlers such that it would be enumerated first, but nothing's stopping someone else from doing the same thing.这留下了第 2 阶段。您唯一能做的就是在 ContextMenuHandlers 下命名您的条目,以便首先枚举它,但没有什么能阻止其他人做同样的事情。

This is for Windows 7, maybe same for newer versions.这适用于 Windows 7,可能与较新版本相同。 It was inspired by the other answers, all is affecting the order.它受到其他答案的启发,一切都在影响顺序。

I'm explaining entries for "*" (all files), but the same goes for special extensions.我正在解释“*”(所有文件)的条目,但对于特殊扩展名也是如此。

I take no responsibility for any changes made in registry!我对注册表中的任何更改不承担任何责任!

There are three sections in the context menu, as it says in How to Change the Order of Options in Context Menu (from answer by @Anonymouse )上下文菜单中有三个部分,如如何更改上下文菜单中的选项顺序中所述(来自@Anonymous 的回答

They call them:他们称他们为:

2 - Default menu position (at the top).
1 - Send to, copy to folder and move to folder menu part (in the middle).
0 - Rename menu part (at the bottom).

Within these sections the position is decided by the rules in answer by @Luke在这些部分中,position由@Luke 回答的规则决定
The easiest way to change the order within the "section" is to change the name of the registry key under HKCR-*-shell or HKCR-*-shellex .在“部分”中更改顺序的最简单方法是更改HKCR-*-shellHKCR-*-shellex下的注册表项的名称。 All under subkey shell will be before them under shellex .子项shell下的所有内容都将在shellex下。 Keys that have the CLSID as the key name will be as last entry since they are last in the used order.CLSID作为键名的键将作为最后一个条目,因为它们在使用顺序中排在最后。

As an example, I was following a sample from MSDN to build a Context Menu Handler例如,我正在按照MSDN 中的示例构建上下文菜单处理程序
EDIT 2021-04-14: The MSDN link is no longer valid, it redirects to a "Browse code samples" page.编辑 2021-04-14: MSDN 链接不再有效,它重定向到“浏览代码示例”页面。 You can search there for Context menu sample , but the one I followed seems to have been removed.您可以在那里搜索Context menu sample ,但我关注的那个似乎已被删除。
The closest to the old one I followed is perhaps this最接近我关注的旧的可能是这个

The one I followed is using the CLSID as the name for the key under shellex , and a "friendly name" as default value.我遵循的方法是使用CLSID作为shellex下键的名称,并使用“友好名称”作为默认值。 It was placed at the bottom of "section" 2 (top section).它被放置在“部分”2(顶部)的底部。 I changed the key name to something like Asample and changed the default value to be the CLSID instead.我将键名更改为Asample之类的名称,并将默认值更改为CLSID Now it was directly after entries under shell .现在它直接在shell下的条目之后。

There are some more ways of changing the order.还有一些改变顺序的方法。

For keys under shell you can add the value Position with string data Top or Bottom .对于shell下的键,您可以将值Position与字符串数据TopBottom添加。 Not possible to decide in what "section".无法决定在哪个“部分”。

For keys under shellex the value Position has no effect.对于shellex下的键,值Position无效。 Instead it's possible to decide in what "section" the entry will be using flags , described in the link above.相反,可以决定条目将在哪个“部分”使用flags如上面的链接中所述。

  1. Use the CLSID for the shellext you want to move.为要移动的 shellext 使用CLSID It's like就像是
    {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} . {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} Get it either from the key name or the default value, it depends on how the entry is done.从键名或默认值中获取它,这取决于条目是如何完成的。
  2. Find the entry under HKCR-CLSID, the key has the name of the CLSID .找到 HKCR-CLSID 下的条目,该键具有CLSID的名称。
  3. Add a value with name flags and data DWORD with the "section" number described above under the found CLSID .在找到的CLSID下添加一个带有名称flags和数据DWORD的值,上面描述的“节”号。

This Q&A shows a simple way to CREATE (not move) an item within the context menu. 此问答展示了一种在上下文菜单中创建(而不是移动)项目的简单方法。 I managed to duplicate an existing item.我设法复制了一个现有项目。 Then I moved my item to a higher and more accessible position within the context menu, by renaming the key to start with something "aMyItem" or "0MyItem".然后我将我的项目移动到上下文菜单中更高且更易于访问的 position,方法是将密钥重命名为以“aMyItem”或“0MyItem”开头。

This did it for me... Steps 4 through 7 - setting the "flags" http://techoqueries.blogspot.de/2012/08/how-to-change-order-of-options-in.html这是为我做的......步骤4到7 - 设置“标志” http://techoqueries.blogspot.de/2012/08/how-to-change-order-of-options-in.html

I've been trying to find a way to re-order things, it irritates me that the daily use options are pushed to the end, when obscure utilities you might use once in a blue moon are filling up the top of the list.我一直在试图找到一种重新订购东西的方法,这让我很恼火,日常使用选项被推到最后,当你可能会在蓝月亮中使用一次的晦涩实用程序填满列表的顶部时。

I found a lazy way to do this, using a little utility package called "Windows 10 Manager" Windows 10 Manager - it's a few quid, but it's a lot easier than registry hacking.我找到了一种懒惰的方法来做到这一点,使用一个名为“Windows 10 管理器” Windows 10 管理器的小实用程序 package - 它只需几英镑,但比注册表黑客攻击容易得多。 It can't do everything, but it does let you add items into the top section at least - and also to suppress cheeky ones that installed themselves in there without asking.它不能做所有事情,但它确实让你至少可以将项目添加到顶部 - 并且还可以压制那些不经询问就安装在那里的厚脸皮的项目。 显示修改后的上下文菜单的示例

As you can see, it's actually duplicated some entries rather than moving them, but never mind.如您所见,它实际上是复制了一些条目而不是移动它们,但没关系。

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

相关问题 在Windows资源管理器上下文菜单中添加分隔符(不在子菜单中) - Add a separator in the Windows Explorer context menu (not in a submenu) 涵盖Windows资源管理器上下文菜单应用程序! - Getting Coverage for Windows Explorer Context Menu Application! Eclipse 插件显示 Windows 资源管理器上下文菜单 - Eclipse Plugin to show Windows Explorer context menu 将程序添加到Windows资源管理器上下文菜单 - Adding program to the windows explorer context menu 使用Windows资源管理器的“打印”上下文菜单项 - Using Windows Explorer 'Print' context menu entry Windows资源管理器上下文菜单上的InfoTip - InfoTip on Windows explorer context menu item 是否可以将Windows资源管理器上下文菜单替换为菜单以外的其他菜单? - Is it possible to replace the windows explorer context menu with something other than a menu? 如何为Java应用程序向Windows资源管理器添加上下文菜单? - How can I add a context menu to the Windows Explorer for a Java application? Windows资源管理器右键单击文件和文件夹的上下文菜单 - Windows Explorer right click context menu for files and folders 如何显示 Windows 资源管理器上下文(右键单击)菜单? - How to show Windows Explorer context (right click) menu?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM