Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Context Menu - Create Cascading Menu of Multiple Layers



Context Menu - Create Cascading Menu of Multiple Layers

How to Create a Desktop Cascade Context Menu of Multiple Layers in Windows
Published by DanSitar
27 Jan 2013
Published by

How to Create a Desktop Cascading Context Menu of Multiple Layers in Windows

information   Information
This tutorial will help show you how to build your own cascading context menu on the desktop in Windows 7 and Windows 8.

Therefore, stop reading and make yourself a list of 12 programs that can be divided into three main categories, where one will have a sub-category of two programs, like accessories.

By example:

Text ➤ [two types of editors: Notepad, Word], Accessories ➤ [Character map and Calculator].


EXAMPLE: Category Media = four layers, Category Text = three layers, Category System = three layers

Name:  Cascade_Menu-Média2.png
Views: 1671
Size:  344.9 KB Name:  Cascade_Menu-Texte2.png
Views: 1659
Size:  353.6 KB
Name:  Cascade_Menu-Système2.png
Views: 1647
Size:  351.9 KB




PART 1
The Preparation
1. The structure

Welcome back with your list of 12 programs. Exciting, isn't it?. Let's make YOUR menu. That will be fun and easy! I am using these general terms throughout this coaching in order for everyone to substitute their own categories and programs.
Quote:
Layer #1: The Title ➤ (when you right-click on your desktop)
Layer #2: Category 1 ➤ , Category 2 ➤ and Category 3 ➤.
Layer #3 (opened from Category 1): program 1a, program 1b, program 1c and program 1d.
Layer #3 (opened from Category 2): program 2a, program 2b, separator and Category 4 ➤
Layer #3 (opened from Category 3): program 3a, program 3b, program 3c and program 3d.
Layer #4 (opened via Category 2): program 4a and program 4b.
Note: The maximun of items is 17, which includes the categories, the programs and the separators. Therefore, if you want to add another separator, then you will have to remove a program, vice-versa.
a) Let's write down in a text file the structure of your menu and all the paths of your programs and their icons. Then, once we have verified your syntax and the data, we will copy & paste everything quickly in the registry to avoid any typo and a too long session in it. Save you text file right NOW even if it is empty. Then, Ctrl+S often.

Start by filling the two first columns with your four categories and 12 programs, where the first one is the program's name Without Space for the keys, and in the second one, the name that you want to see on the menu. We will add the paths later. Example of the first line:
“New_Keys” : ........ “Seen on the menu”..............
TheTitle :: ............ The Title ............................

CascadeMenu :: .... ¯¯¯ Cascade—Menu __(°¿°)...
Name:  Cascade_Menu2.png
Views: 1653
Size:  386.0 KB
The template:
Code:
“New_Keys” : ..“Seen on the menu”. “Icon's path” .... “Program's path”
 
TheTitle :: ... " The Title" ..... _____________
 
Category1 : ... " Category #1" ... _____________
Program1a : ... " Program #01" ... _____________ ...  _________________
Program1b : ... " Program #02" ... _____________ ...  _________________
Program1c : ... " Program #03" ... _____________ ...  _________________
Program1d : ... " Program #04" ... _____________ ...  _________________
 
Category2 : ... " Category #2" ... _____________
Program2a : ... " Program #05" ... _____________ ...  _________________
Program2b : ... " Program #06" ... _____________ ...  _________________
 
Category3 : ... " Category #3" ... _____________
Program3a : ... " Program #07" ... _____________ ...  _________________
Program3b : ... " Program #08" ... _____________ ...  _________________
Program3c : ... " Program #09" ... _____________ ...  _________________
Program3d : ... " Program #10" ... _____________ ...  _________________
 
Category4 : ... " Category #4" ... _____________
Program4a : ... " Program #11" ... _____________ ...  _________________
Program4b : ... " Program #12" ... _____________ ...  _________________
b) OK. Let's group your keys into Arrays that will have no space. A semi-colon; ’ separates each key and each separator that is the | character.

The Arrays:
Code:
TheTitle  = [Category1;Category2;Category3]
Category1 = [Program1a;Program1b;Program1c;Program1d]
Category2 = [Program2a;Program2b;|;Category4]
Category3 = [Program3a;Program3b;Program3c;Program3d]
Category4 = [Program4a;Program4b]
Note: The order of the items on your menu is according to the content of your Arrays. So, if you want the Category 4 to be on top instead and the two programs under the separator, change the Category2's Array from:
Program2a;Program2b;|;Category4
to
Category4;|;Program2a;Program2b
c) Add also these special words on a separated line because they will be copied & pasted many times. If you copy & paste them from here, make sure there are no extra characters at their ends, like ‘\n’ or a space.

The special words:

command
Icon
MUIVerb
SubCommands

Note: See also the template and the Arrays of the photos above in my first comment.
2. The Paths of your Programs and their Icons

The best way to avoid any typo is to copy & paste them from your Windows Explorer.

Tip   Tip
To switch quickly from the Explorer to your text file, hold down the ALT key on the left of the space bar while you press the Tab key as many times as you need to select the proper window. Release the TAB key first, then, the switch appends when you release the Alt key. The quickest is to have only two windows opened.

To copy the path of a file, hold down the Shift key and right-click on the file. That adds a few more shortcuts on the context menu. You should find a new one like ‘copy as path’. If your windows version does not provide that feature, install a very useful tool that does it, like ClipboardPath.
The Syntax of the path.

a) The path that has a space in it must be quoted:
"C:\Program Files (x86)\folder\program.exe"
Brief, space = quotes; no_space = no_quote.

b) The Path of the icon:
  • must include its index number,
  • be separated from the path by a comma ‘ ,
  • and be outside the end quote if there is a space in the path:
    path,index_number
"the path",index_number
c) If the file contains only one icon, then the index number is zero:
    path,0
"the path",0
Tip   Tip
To find the index number of an icon from a file that has many, sometime hundreds, just personalize a folder with that icon (Right-click on a folder > Properties > Personalize tab > Change Icon...). Then, open the ‘desktop.ini’ file in that folder with a text program. Just copy the ‘Path,index_number’ that follows the instruction “IconResource=”.


The paths that have spaces are not quoted in the ‘desktop.ini’ file. Therefore, you must add them and make sure that the ending one is just before the comma ,index_number. Example:
"C:\Program Files (x86)\folder\program.exe",5
Note: The ‘desktop.ini’ is a Hidden System file. So, you might have to show it:

Window Explorer > Tools > Folder Options... > View. In the [Advanced Settings] and under the little folder {hidden files and folders}, select (•) “show hidden files & folders”. OK.
Name:  Desktop,ini.png
Views: 1641
Size:  35.7 KB
3. Verification of your text file


⌊√⌉ It is easier and safer to make some corrections or changes in the file than messing up your registry.
  1. ⌊ ⌉ Is there any space in your New_Keys (first column)? There should be NO space.

  2. ⌊ ⌉ Is there any space in the Arrays of each Category? There should be NO space.

  3. ⌊ ⌉ Does each key and each separator in those Arrays separated by a ‘ ; ’ semi-colon?

  4. ⌊ ⌉ Are the paths with spaces quoted at both ends?

  5. ⌊ ⌉ Is the Icon index number separated from the path by a comma ‘ , ’ and is outside the last quote if there is one, i.e.,
    path,index_number or "the path",index_number?
  6. ⌊ ⌉ The paths that have spaces are not quoted in the ‘desktop.ini’ file. Did you forgot to add the quotes,
    and make sure that the ending one is just before the comma ,index_number?

  7. ⌊ ⌉ Did you picked up the ‘ = ’ character by mistake from the instruction “IconResource=” in the ‘desktop.ini’ file?

  8. ⌊ ⌉ Is there any typo in the extra words: command, Icon, MUIVerb and SubCommands?



PART 2
Editing the Registry


The key [HKEY_CLASSES_ROOT\DesktopBackground\Shell\...] is at the base of the Desktop Context Menu, where sits the ‘Screen Resolution’, ‘Gadgets’, ‘Personalize’ and other shortcuts. That first layer has also the ‘New’ trigger cascading to a second layer of a bunch of shortcuts.

Likewise, let's make another trigger on that first layer that will cascade to a second layer, but of your three categories instead. Then, each one will cascade to its own layer of a few shortcuts.
1. Making backups of the branches that we will change
a) Open the Registry Editor: Start Menu > write regedit > click on the program “Regedit.exe” above (right-click on it if you want to Pin it to the Start Menu for a while).

b) Go to the key [HKEY_CLASSES_ROOT\DesktopBackground\Shell], select “Shell” and bookmark it with the name: DesktopBackground (See "Favorites" on the menu above).
Name:  Cascade_Menu-Bookmark1.png
Views: 1616
Size:  15.7 KB
c) Right-click on “Shell” > Export > name it Desktop_Background-today's date, choose the Selected Branch option and OK.
Name:  Desktop_Background-2013-01-18.png
Views: 1606
Size:  12.2 KB
d) Go to the key
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell]

e) Select “shell” and bookmark it with the name: CommandStore.
Name:  Cascade_Menu-Bookmark2.png
Views: 1592
Size:  24.3 KB
f) Likewise, right-click on “Shell” > Export > name it Command_Store-today's date, choose the Selected Branch option and OK.
Name:  Command_Store-2013-01-18.png
Views: 1592
Size:  12.8 KB
2. Are your New_Keys unique in the context menu?
a) Check if each of your keys exist in the …\CommandStore\shell column. If it does, then change the name of your key in your text file under the “New_Keys” column AND in the Array. That will not affect what you want to see on your menu.

b) Click on your ‘DesktopBackground’ bookmark and check if your Title key exist. If it does, change its name under the “New_Keys” column.
3. Creating the main trigger on the first layer

Select-copy your equivalent of ‘TheTitle’ from your text file, then, Alt+Tab to switch to the register.
a) Right-click on the “Shell” key > New > Key. Paste your Title key as its new name.
Name:  Cascade_Menu-yourTitle.png
Views: 1598
Size:  19.1 KB
b) Copy the word MUIVerb from your file. Then, right-click on the empty space below “(default)” > New > String Value. Paste the word: MUIVerb as its new name.

c) Copy The Title that you want to see from your file (second column). Then, right-click on “MUIVerb” > Modify... > paste it.

Tip   Tip
If you want to center that name on your menu, just add a few spaces before it. Example:
"   Cascade Menu" without the quotes.

d) Its ICON:
As you noticed, the menu opened by “Right-click > New > ” has many types of Value under "Key". When our action is on the right pane of the window, we will always choose the “String Value”, except when the Icon's Path starts with the ‘%’ character.

You see, that special character identifies a %variable% in the path. Therefore, we have to create a different type of value that can EXPAND to the real length of the path represented by that %variable%. Therefore, we choose an ‘EXPANDable’ value (the last one), which results as a “REG_EXPAND_SZ” in the [Type] column, instead of the usual “REG_SZ”. Make sense?
Name:  Icon-REG_EXPAND_SZ.png
Views: 1614
Size:  29.1 KB Name:  Icon-REG_SZ.png
Views: 1607
Size:  22.2 KB
e) Copy your Title's Icon Path from your file.

f) On the right pane of your Title key, right-click on the empty space > New > String or Expandable Value. Name it: Icon

g) Then, right-click on “Icon” > Modify... > paste its Path,index_number.
Name:  Icon-Modifier_données.png
Views: 1584
Size:  13.0 KB
h) Copy the word SubCommands from your file. Then, right-click on the empty space > New > String Value. Paste the word: SubCommands as its new name.

i) Copy the content of your first Array, the one of the three categories, from ‘TheTitle = [Category1;Category2;Category3]’. Then, right-click on “SubCommands” > Modify... > paste your equivalent of Category1, Category2 and Category3.
CONGRATULATION‼ The first layer of the desktop menu is done! Try it!

You might want to adjust the position of your title by adding/removing a space in front of it (right-click on “MUIVerb” > Modify... >). But I suggest for those who are still in Windows 7 to leave or put at least one space in front of every category and program's name. It separates them nicely from the too closed icons as oppose to the ‘Screen Resolution’, ‘Gadgets’, ‘Personalize’ ones. Compare the effect in my photos above.


4. Crafting the Cascade

This is the time to ship our new menu to the ‘Command Store’ and shift into a ‘Production Mode’. Click on your “CommandStore” bookmark to reach the key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell]
4.1 Creating all the Keys from your first column “New_Keys”.

We will create 16 New_Keys (four Categories and 12 Programs) by repeating this process.
a) Copy your equivalent of a Category/Program from your file.

b) Right-click on the “Shell” key > New > Key.

c) Paste it as its new name.

d) Use your bookmark to get back to the “Shell” key.

e) Repeat a) to d) for the remaining keys.
4.2 Creating the Values (names) on the right pane.
a) To the four Categories ONLY:

a1) Copy the word MUIVerb from your file.

a2) Select a category on the left pane.

a3) Right-click on the right pane on the empty space below “(Default)” > New > String Value. Paste the word: MUIVerb as its new name.

a4) Do the same to the remaining Categories.

a5) Copy the word SubCommands from your file.

a6) Repeat the steps a2 and a3 but with the word: SubCommands instead.


b) To both, Categories and Programs:

b1) Copy the word Icon from your file.

b2) Select a Category/Program on the left pane.

b3) Right-click on the right pane on the empty space > New > String or Expandable Value if there is a %variable% in the path. Paste the word: Icon as its new name. (See photos in Part 2, 3.d)

b4) Repeat the steps b2 and b3 for the remaining Categories and Programs.
4.3 Creating the “command” SubKeys.
a) Copy the word command from your file.

b) Leaving your Category Keys alone, right-click on the key of every Program you just made > New > Key. Paste the word: command as its new name. You have 12 programs to do.
5. Giving Life to your Cascade Context Menu of four layers!!

We are done creating keys and values. This final step is to assign a duty to each shortcut and where to get its icon.
5.1 Connecting the layers together.
a) Copy the name you want to see of the Category #1.

b) Select that Category on the left pane.

c) On the right pane, right-click on “MUIVerb” > Modify... > (Windows 7: Press the space bar once before you) paste the name. The space is to separate the names nicely from the too closed icons in Windows 7.

d) Copy the content of the Array of that category, i.e., your equivalent of the Array "Category1 = [Program1a;Program1b;Program1c;Program1d]"

e) On the right pane, right-click on “SubCommands” > Modify... > Paste that content.

f) Repeat the steps a) to e) for the remaining Categories.
Name:  Cascade_Menu-Cat1.png
Views: 1590
Size:  18.9 KB Name:  Cascade_Menu-Cat2.png
Views: 1593
Size:  24.1 KB
Name:  Cascade_Menu-Cat3.png
Views: 1586
Size:  17.7 KB
Try your menu! It should cascade even if the programs are not listed yet! Great, isn't it? If it works, jump to the next process (5.2 Listing the shortcuts). Else, if the “Verification of your text file” in Part 1, section four went well, then, compare your file with your actions in the registry from the Part 2, section 2. If it still doesn't work, verify your text file again.

5.2 Listing the shortcuts.
a) Copy the name you want to see of a Program.

b) Select that Program's key on the left pane.

c) On the right pane, right-click on “(Default)” > Modify... > (Windows 7: Press the space bar once before you) paste the name.

d) Repeat the steps a) to c) for the remaining Programs.

∫ ̮ʼ̃ʖ Try your menu! It should cascade and list your programs‼ ̒̃८̡ ֹ̒̃ ͠ˀʅ
5.3 Giving the icon and the mission to each shortcut.
a) Copy the “Icon's path” of a program.

b) Select that Program's key on the left pane.

c) On the right pane, right-click on “Icon” > Modify... > Paste its path (with the icon index number).

d) If the icon comes from that program, continue. Else, copy the “Program's path”.

e) Select the “command” key of that Program on the left pane.

f) On the right pane, right-click on “(Default)” > Modify... > Paste the path, delete the ",index_number" of the Icon's path, including the ‘ , ’ character. OK. Be careful not to delete the end quote of the paths that need to be quoted.

g) Repeat the steps a) to f) for the remaining Programs.

h) Close the Registry editor. Voilà‼
٩̢ ̗(Ӧ̮Ӧ)ʅ۶Enjoy YOUR desktop Cascade Context Menu of four layers‼ ̒¿ ̡̒ ˀʅ
6. The Changes

You will eventually want to change or remove a program, a category, a separator or an icon. I recommend to make your changes in your text file first. But before you do so, copy & paste at the end: the template, the Arrays and the special words, then, edit that section instead. That will keep your original intact in case you make some mistakes.

Once ready to edit, double-check your changes with Part 1, section 3: “Verification of your text file”. Then, start your editing from Part 2, section 1: “Making backups of the branches that you will change.”
Continued on next post.....
27 Jan 2013   #1
DanSitar

Windows 7 v.6.1 Edition Familial Premium on a 64 bit laptop
 
 
The template and the Arrays of the cascade context menu in the photos

Note   Note
Appendix

The template and the Arrays of the photos.
Name:  Cascade_Menu-Média2.png
Views: 1589
Size:  344.9 KB Name:  Cascade_Menu-Texte2.png
Views: 1613
Size:  353.6 KB

Note that I used only 11 programs because I added another separator on the layer #2.
Code:
New_Keys” : ........... “Seen on the menu” ........... “Icon's path” ............................................... “Program's path”
 
CascadeMenu :: ......... " ¯¯¯¯¯Cascade—Menu"__(°¿°)...  D:\Doc\Data\Config\Cascading\Cascade_Iconex16a.ico
 
Texte : ................ " ¯¯Texte¯¯" .................  hwrreg.exe,0
TextPad5 : ............. " TextPad 5" .................  "C:\Program Files (x86)\TextPad 5\TextPad.exe",0 ...........  "C:\Program Files (x86)\TextPad 5\TextPad.exe"
BlocNotes : ............ " Bloc-notes" ................  notepad.exe,0 ..............................................  notepad.exe
WordPad : .............. " Wordpad" ...................  "C:\Program Files\Windows NT\Accessories\wordpad.exe",0 ...   wordpad.exe
TableCaracteres : ...... " Table des Caractères" ......  charmap.exe,0 ..............................................  charmap.exe
 
Media : ................ " ¯¯Média¯¯" .................  dvdplay.exe,0
CyberLinkPowerDVD9 : ... " CyberLink PowerDVD 9" ......  "C:\Program Files (x86)\CyberLink\PowerDVD9\PowerDVD9.exe",0  "C:\Program Files (x86)\CyberLink\PowerDVD9\PowerDVD9.exe"
WindowsMediaCenter : ... " Windows Media Center" ......  %windir%\ehome\ehshell.exe,0 ...............................  C:\Windows\ehome\ehshell.exe
 
Systeme : .............. " ¯¯Système¯¯" ...............  SHELL32.dll,272
HDDregenerator : ....... " HDD Regenerator" ...........  "C:\Program Files (x86)\HDD Regenerator\Shell.exe",0 .......  "C:\Program Files (x86)\HDD Regenerator\Shell.exe"
GestionCPU : ........... " Gestion de l’ordinateur" ...  Mycomput.dll,-204 ..........................................  CompMgmtLauncher.exe
runas : ................ " Invite de commandes (Admin)"  HasLUAShield (replaces the word ‘icon’ and has no path).....  Cmd.exe /T:3B /s /k pushd "%V"
 
CabISO : ............... " ¯¯Cab and ISO¯¯" ...........  D:\Icônes\_Icônes\CDcouleurs.ico
CabMaker : ............. " Cab Maker" .................  "C:\Program Files (x86)\Cab Maker\Cab Maker.exe",0 .........  "C:\Program Files (x86)\Cab Maker\Cab Maker.exe"
PowerISO : ............. " PowerISO" ..................  "C:\Program Files (x86)\PowerISO\PowerISO.exe",0 ...........  "C:\Program Files (x86)\PowerISO\PowerISO.exe"
My Arrays:
Code:
CascadeMenu  = [Texte;Media;|;Systeme]
Texte = [TextPad5;BlocNotes;WordPad;TableCaracteres]
Media = [CyberLinkPowerDVD9;WindowsMediaCenter;|;CabISO]
Systeme = [HDDregenerator;GestionCPU;runas]
CabISO = [CabMaker;PowerISO]
Note that I avoided using any accent in my keys just in case. But it is ok to use them in the names I want to see on the menu.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The last shortcut in the category “Système” ➤ "Invite de commandes (Admin)" is a Command Prompt as Administrator, thanks to the runas key. It opens at the actual directory and is in COLOR, thanks to the option /T:3B in the command:
Cmd.exe /T:3B /s /k pushd "%V", where the “3B” is the background and the foreground colors. Type COLOR /?

Name:  Cascade_Menu-CmdAdmin.png
Views: 1618
Size:  240.1 KB
To implement this into the context menu of the Windows Explorer, see my How to in the comment #22 “Command Prompt "here" as Admin in color” in the Tutorial How to Add a "Accessories" Cascading Desktop Context Menu in Windows 7

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note: If your menu has a program that should not be launched during a Windows Safe Mode,
a) Copy the word: HideInSafeMode in your file.

b) Open the registry and click on your CommandStore's bookmark.

c) Select the key of that program,

d) Right-click on the right pane on the empty space > New > String Value. Paste the word: HideInSafeMode as its new name.

e) Close the Registry editor.
It would be interesting to find a verb to Hide them to a certain user, like for a child by example.




Have fun!!!

Daniel Bourdon



My System SpecsSystem Spec
02 Mar 2013   #2
Brink
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

Great job Dan.
My System SpecsSystem Spec
04 Mar 2013   #3
DanSitar

Windows 7 v.6.1 Edition Familial Premium on a 64 bit laptop
 
 

You are welcome, Brink. Your improvement of my newbie layout made it look highly professional. Let's see what multi-layers cascading context menus people will come up with.
My System SpecsSystem Spec
.


2 Weeks Ago   #4
sweatyHotdogs

Windows 7 Ultimate x64
 
 
help

i followed your guide but still no multi layered context menu for me... can someone send me a copy of their registries?? reverse engineering always works for me... thanks
My System SpecsSystem Spec
2 Weeks Ago   #5
Brink
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

Hello sweatyHotdogs, and welcome to Seven Forums.

I can't find a context menu with multiple expanding layers, but here's one that cascades with separators to help some for now. You can edit the .reg file from step 3 to see the details.

Personalize - Add or Remove Expanding Desktop Context Menu
My System SpecsSystem Spec
2 Weeks Ago   #6
sweatyHotdogs

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by Brink View Post
Hello sweatyHotdogs, and welcome to Seven Forums.

I can't find a context menu with multiple expanding layers, but here's one that cascades with separators to help some for now. You can edit the .reg file from step 3 to see the details.

Personalize - Add or Remove Expanding Desktop Context Menu
wow... thanks... weird that page never showed up in google search... EDIT: not what im looking but thanks... i need layers... LAYERZZORR :3
My System SpecsSystem Spec
Comment

 Context Menu - Create Cascading Menu of Multiple Layers




Tutorial Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 08:20 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33