How can I change the order of the entries in the context menu?(e.g. for Directories) I need to know how Windows determines the order when showing that so I can control it. For example I want to place my custom action at the end of the context menu list
Thank in advance!
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 . All under subkey shell will be before them under shellex . Keys that have the CLSID as the key name will be as last entry since they are last in the used order.
A context menu is a pop-up menu that provides shortcuts for actions the software developer anticipates the user might want to take. In a Windows environment, the context menu is accessed with a right mouse click.
Open File Explorer and right-click any folder to open the context-sensitive menu. Then position ShellMenuView and File Explorer side-by-side (Figure C). Now pick a specific command from the File Explorer menu that you never use and want to remove. Look for its entry in the ShellMenuView window.
My Google-fu led me to this:
So the sorting is based on the following elements in decision order:
- Key priority (eg, txtfile, *, AFSO)
- Registry Enumeration order of shellex\contextmenuhandlers with a special case for static verbs always being first
- IContextMenu Implementation order
So if there is any contention for position, there is no consistent way for an extension to guarantee their relative position within the menu.
Obviously you can't do anything about phase 1. Phase 3 only applies to the verbs implemented in your handler. 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With