How to Create Cascading Menus with the ExtendedSubCommandsKey Registry Entry
In Windows 7 and later, you can use the ExtendedSubCommandsKey subkey to create extended cascading menus.
The following screen shot is an example of an extended cascading menu.
Because HKEY_CLASSES_ROOT is a combination of HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE, you can register the subverbs under the HKEY_CURRENT_USER\Software\Classes subkey. The advantage of doing so is that elevated permission is not required. Other file associations can reuse this entire set of verbs by specifying the same ExtendedSubCommandsKey subkey. If you do not need to reuse this set of verbs, you can list the verbs under the parent. In this case, make sure the default value of the parent is empty, as illustrated in the registry entry example in this section.
Create a subkey under HKEY_CLASSES_ROOT\ProgID\shell\CascadeMenuKey and give the CascadeMenuKey a name such as CascadeTest, for example. Then add a MUIVerb entry of REG_SZ type and give it a name such as Test Cascade Menu 2, as illustrated in the following registry example.
HKEY_CLASSES_ROOT txtfile shell CascadeTest MUIVerb = Test Cascade Menu 2
Under the CascadeTest subkey that you created, add an ExtendedSubCommandsKey subkey, and then add the document subcommands (of type REG_SZ); for example:
HKEY_CLASSES_ROOT txtfile Shell Test Cascade Menu 2 (Default) ExtendedSubCommandsKey Layout Properties Select all
Ensure that the default value of the Test Cascade Menu 2 subkey is empty, and shown as (value not set).
Populate the subverbs using any of the following static verb implementations. Note that the CommandFlags subkey represents EXPCMDFLAGS values. If you want to add a separator before or after the cascade menu item, use ECF_SEPARATORBEFORE (0x20) or ECF_SEPARATORAFTER (0x40). For a description of these Windows 7 and later flags, see IExplorerCommand::GetFlags. ECF_SEPARATORBEFORE works only for the top level menu items. MUIVerb is of type REG_SZ, and CommandFlags is of type REG_DWORD.
HKEY_CLASSES_ROOT txtile Shell Test Cascade Menu 2 (Default) ExtendedSubCommandsKey Shell cmd1 MUIVerb = Notepad command (Default) = %SystemRoot%\system32\notepad.exe %1 cmd2 MUIVerb = Wordpad CommandFlags = 0x20 command (Default) = C:\Program Files\Windows NT\Accessories\wordpad.exe %1
The following screen shot is an illustration of the previous registry key entry examples.