Right-click the custom menu (stacked menu: cascading menu)

Source: Internet
Author: User

Author: KillerLegend

From: http://www.cnblogs.com/killerlegend/p/3575391.html

Date: Tuesday, February 18,201 4

There was no Internet connection at home during the Spring Festival. After this article was written, it was published ...... Haha

Right-click the custom menu (stacked menu: cascading menu)

There are three methods to create an ECS instance on MSDN:

  • Creating Cascading Menus with the SubCommands Registry Entry
  • Creating Cascading Menus with the ExtendedSubCommandsKey Registry Entry
  • Creating Cascading Menus with the IExplorerCommand Interface

Official website information here: http://msdn.microsoft.com/zh-cn/library/cc144171 (v = vs.85)

Today, the first method is used to implement a custom right-click menu, that is, using SubCommands to implement a stacked menu. The effect is shown in the red box:

All content, such as applications, and icons displayed on the left, can be customized and implemented according to your own interests.

First, we manually step through the registry options to understand the implementation principles, and finally use the registry code to achieve one step:

Right-click to add a ContextMenu option, and then add various applications to open:

Step 1: Go


Create a key as shown in Figure 1.1, and name it ContextMenu.

Right-click the left blank space and choose create a new string value, as shown in Figure 1.2,

Set the name to MUIVerb and the name must be MUIVerb. This is the so-called standard name (Canonical Verbs ). double-click it and set its value to ContextMenu, which is the name displayed by right-clicking the string (you can also set it to another value), as shown in 1.3:

After this step, you can right-click a specific file, and a right-click option named ContextMenu appears. Note that it is a file rather than a directory. in other words, right-clicking an application, doc file, txt text, or image will not appear in a folder containing sub-files or right-clicking on the desktop. 1.4 and 1.5 are compared.

Then we need to add commands for the options we have added, and create a SubCommands in the same steps as creating MUIVerb,

The value is set to ContextMenu.1; ContextMenu.2; ContextMenu.3; ContextMenu.4; ContextMenu.5. Let's add these five options first. Each option corresponds to a command (application ), later I will talk about setting the specific execution path for each command. 1.6.

At this time. Right-click an application icon and you can see a small black arrow on the right side of the ContextMenu option, but it cannot be expanded yet because we have not added a specific application for it, 1.7.

Step 2:

Now let's add specific command options so that the small black arrow can be expanded. Open to the following position in the registry:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \ CommandStore \ shell \

Then create a new key in shell, as shown in 2.1, named ContextMenu.1

Go to ContextMenu.1 and set the default value to the Application name (in short, the character you want to display), as shown in figure 2.2.

Create a new key in ContextMenu.1 with the name "command" and go to the new command key. The default value in the command key is set to the Application Path, as shown in Figure 2.3.

Create ContextMenu.2; ContextMenu.3; ContextMenu.4; ContextMenu.5 in the same way. 2.4.

For convenience, I set them to notepad. The initial results are shown in 2.5.

Obviously, there is no icon in this option, which is quite uncomfortable, so we only need a simple operation to add icons for each option.

Step 3:

Take one of the options as an example to add an icon, go to ContextMenu.1, and add an icon project to it. Set the value to the application path or the image path you have defined. 3.1.

Now, right-click a file, and the icon is displayed, as shown in Figure 3.2. However, the parent level does not have an icon, and you can add it in the same way.

Step 4:

The above button appears only when you right-click the file. If you add these positions under the Registry as per step 1, you can right-click the folder or the desktop.

[HKEY_CLASSES_ROOT \ Directory \ Background \ shell \]

[HKEY_CLASSES_ROOT \ Directory \ shell \]

[HKEY_CLASSES_ROOT \ LibraryFolder \ background \ shell \]

Step 5:

However, if you follow the steps above, it is very tiring. If I add 7-8 Options, it can be really good, but don't worry. Now we use code to implement it, which is very simple: in the Registry Code of Windows 7, the start must start with Windows Registry Editor Version 5.00 (that is, the start of the reg file is not allowed to have blank rows), then a blank line is left blank, and the path is enclosed in brackets, write the content to be added below. In short, I do not understand the complicated features that we need to implement. Use the code to add a new right-click menu, and name it TestMenu. OK. The Code is as follows:

Add a right-click option (download code ):

Add a function (download code) for the added right-click option ):

Save them as first. reg and second. reg, and run them in sequence.

The final effect of the above Code is shown.


NOTE 1: The Code "SubCommands" = "TestMenu.0; TestMenu.1; TestMenu.2; TestMenu.3; |; TestMenu.4" contains a split line. If you do not like it, remove it. In addition, the path separator enclosed in double quotation marks must be two and must be escaped. @ Indicates the default value.

NOTE 2: If you want to modify one of the functions, such as modifying Notepad4 to the software that comes with win7, you can change the last code to the following (download code ):

The result is shown in addition:

Note 3: The modified code overwrites the previous registry options.

I also attached four practical right-click management tools (click to download), four software around 11 M, so that I was too busy to upload several k of the network speed for more than half a night, it was too difficult, I sincerely thank Mr. Xin for providing us with such powerful network speeds at school. During the Spring Festival, I spent 200 yuan on 3G network card white blind, and suddenly found that love is like the speed of the network in the mountains, not that you are willing to pay, telecom operators will give you awesome speed. Haha ......

Only one of them is the installation version, and the other three are the installation-free versions. Unzip the password to my QQ number: 1191509410

------------------------------------------- Knowledge sharing, adding strength to the Internet field in China! ------------------------------------------------------------

Reprinted please indicate the source: you respect others' labor achievements, and others will also treat you. Therefore, respecting others means respecting yourself.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.