Right-click the Registry operating system menu

Source: Internet
Author: User
Tags compressed file types ultraedit

The boss of the company asked me to develop an application for processing digital photos. In order to improve the flexibility of the application, I quickly set up the software, it involves the addition and modification of the right-click menu of the Windows operating system. After several days of summarization and learning, various methods and techniques are summarized as follows:

In Windows, If you right-click a desktop or file (folder), a shortcut menu is displayed, which contains some common operation commands for this file (folder, by right-clicking the menu, you can easily perform operations on files.

The right-click menu should be in the registry. Specifically, it is under the hkey_classes_root Root Key (here is the root of all the commands in the right-click menu !). Expand the root key. There are two subkeys: the extension key (. + extension) and the class definition key. Generally, as long as the extension has been registered in windows

Hkey_classes_root has a subkey "· this extension", which records some information about this extension and modifies the context menu of a specific type of file, is the operation under this key or the "file extension" key.

1. Right-click all files and add the command

If your system is installed with WinZip, ultraedit, and so on, when you right-click any file, there will be "add"
Zip, UltraEdit-32 and other commands (of course, WinZip is slightly different, I will talk about it later ). It can be added:

(1) Open "hkey_classes_root /*";

(2 ). create a new "shell/command" branch under it, and set the command key value to the absolute path of the executable program used to execute the command, and add "% 1" after it.
For example, in "hkey_classes_r
Create a new "shell/Open/command" sub-key under oot/* "and set the command key value to" C:/Windows/notepad.exe"
% 1, the "open with WordPad" command will appear in the right-click menu.
Note:
<1> to delete a command of this type, you only need to delete the subkey of "command;
<2> Some may ask me why I did what I wrote. This is why my command has a shortcut key (n ), you only need to add "(& amp; n)" after "open with a WordPad.

2. Add commands to the right-click menu of a specific file type

The WinZip software is mentioned just now. For common file types, its right-click menu contains "add to zip", but it supports the compressed file types, such *. zip ,*. cab ,*. RAR in its right-click menu, there are "open with WinZip", "extract to", "extract to folder", "create self-Extractor (. for self-extracting installation files (such as oicq99b), right-click the "run with WinZip" command in the menu. The following describes how to add commands to the right-click menu of a specific file type (for example, add play with Winamp to the right-click menu of an MP3 file ):

(1) Open the "hkey_classes_root/mp3_auto_file" primary key;

(2 ). create "shell/play with Winamp (& amp; P)/command" and set the command key value to "C:/ProgramFiles/Winamp/winamp.exe % 1 ".
Note: When multiple software programs can play MP3 files, you can add multiple commands in the right-click menu, such as play with unreal, but how can we define a command as a default operation (that is, the command in the right-click menu?
Are you sure you want to say something simple! Move the mouse to an MP3 file, right-click the file, and press shift. Select "open mode" in the right-click menu to change the file. However, this is incorrect. Do not believe it, in this way, you can only choose "open" in the right-click menu to open it with the program you selected. Otherwise, it will continue. Because its default operation is not "open" this command. The real method is to change the default shell key value to the command you want to execute, for example, change the shell key value to "Winamp ".
Also, I don't know if you have found it. In the previous example, I used the "Play with Winamp" command, but here I used "Winamp". Isn't it a bit different? Speaking of this, it really makes me sad. Originally, when I used shell in the txt document to convert the default operations (convert open and print), it was quite successful, but a conversion of "Play"
"With Winamp" and "Play with Unreal" fail, but they cannot be converted. In the end, we can understand that this may be a bug in "qingbar, it must be valid only when the key name of the primary key is a single string during conversion. The combination of Chinese characters and English letters is also effective, but there is no space in the middle (I wonder if this is related to my windows 98 version D ?).

If you think the above method is not convenient and too complex, in fact, in Windows, you also provide a more convenient and secure way to do not need to operate the Registry: open a folder, select "View/Folder Options/file type". Here you will find all registered file types and select "mp3 file/edit ", do you see the "new", "edit", "delete", and "set as default" buttons below? I don't need to teach you any more! (However, this method does not apply to the development of the installer ).

3. Right-click all folders and add the command
If you have used the Acdsee software, you will find that there is always the "Browse with acdsee" command in the context menu of the folder, similar Commands include the Trend Pc-cillin 98 command in Pc-cillin. The following describes how to add such commands:

(1) Open the "HKEY_CLASSES_ROOT/diretory/shell" primary key;

(2) create "command/command" under it "...... Let's stop talking about it!

Note:

<1> if you are careful, you will find that in the right-click menu of the drive, there are also "Browse with acdsee" "Trend Pc-cillin98" and other commands, the drive is also a special folder, but the above method cannot add commands in the right-click menu of the drive. If you want to add a command to it, you must operate on the "HKEY_CLASSES_ROOT/drive/shell" primary key;

(3). There is a folder subkey under the "hkey_classes_root" primary key. As the name suggests, operations on it will affect all folders, including the recycle bin. Please remember!

4. Right-click all files and folders and add the command
If you develop a program by yourself, the operation objects are files and folders. Therefore, you want to add specific commands to the right-click menu of all files and folders for operations, you have to look at the following.
Open the "hkey_classes_root/allfilesystemobjects" primary key and create "shell/command" under it. The following operations are the same as before.

5. add and delete some special commands

(1). Resource Manager
In Windows, the "Resource Manager" command is available in the context menu of common folders, drives, and recycle bin. If you only want to keep this command in the drive, you can first Delete the explore subkey in the "hkey_classes_root/folder/shell" primary key, and then create a "explore/command" subkey in the "hkey_classes_root/drive/shell" primary key, make commmand's key value C:/Windows/assumer.exe/e,/idlist, % I, % L!

(2). Clear the recycle bin
In Windows, the "Clear recycle bin" command is only available in the context menu of the recycle bin. Is it too inconvenient? Well, we can make some modifications, let all the file menus have the "Clear recycle bin" command, follow me!
Our idea is to first find out the source of the "Clear recycle bin" command, and then copy it to "hkey_classes_root. Okay, let's look for it first. I can find it and finally find it! Some special commands (especially the software provided by third parties) are all extended libraries (. DLL), you can find its trace in the "shellex/contextmenuhandlers" of the Registry.
Open "HKEY_CLASSES_ROOT/CLSID/{645FF040-5081-101B-9F08-00AA002F954E}
/Shellex/ContextMenuHandlers, you can find that there is a sub-key named "{645FF040-5081-101B-9F08-00AA002F954E}" under it, which is the root of the "Clear recycle bin" command. It is much easier to find the ROOT cause. In "HKEY_CLASSES/ROOT/*/shellex/ContextMenuHandlers", create a subkey named "{token}". How can this problem be solved!

(3) add and delete subcommands for new commands
I don't know if this is the case: You often write web pages by yourself. The new commands on the unit machine contain the "Create html document" command, but you don't have it on your machine, in addition, as various software continues to increase, it takes longer and longer for you to create a new command to bring up sub-commands! It doesn't matter. Don't worry. Let me help you call it out. Don't let it go back!

Open "HKEY_CLASSES/ROOT /. "htm", add a primary key shellnew, and then create a new string value NullFile. The key value is empty. Right-click the table and check whether the new one is more? As for deletion, I don't want you to let me talk about it!

(4) add commands such as cutting, copying, and pasting
Note: I just want to add commands such as cut, copy, and paste. That is to say, you can add some objects without these commands in the right-click menu, I can't do anything to delete objects that have such commands.
Well, I now use the recycle bin as an example to add commands such as cut, copy, and paste. Specifically, you can add commands such as "Open, cut, copy, paste, rename, delete, and attribute.
Open the "hkey_classes_root/CLSID/{645ff040-5081-101b-9f08-00aa002f954e}" primary key first. You will find the "shellfolder" subkey, and create a binary value attributes under this subkey, its key value determines the display and hiding of these commands in the right-click menu. The details are as follows:
Command key value
Open 00 00 00 20
Cut 02 00 00 00
Copy 01 00 00 00
Paste 00 01 00 00
Delete 20 00 00 00
Rename 10 00 00 00
Attribute 40 00 00 00
If you want to display some commands, you only need to add the corresponding key value of the command and the result is used as the key value of attributes. For example, if the attributes value is 00 00 00 (default), the preceding commands are not displayed. If the value is 73 01 00 20, all commands are displayed. Now, you can change the "recycle bin" to the name you want to change, and paste the "waste" to the recycle bin. (However, I don't know how useful this is, yes ?)

(5). "Send" and its menu
Some folders (such as my documents) do not have the "send" command in the context menu. We can add the command to it. For how to add the command, refer to the "Clear recycle bin" command. Is to open"
Hkey_classes_root/CLSID/{export d8fba-ad25-11d0-98a8-0800361b1103}/shellex/contextmenuhandlers ", and create the" {users} "subkey under it.

As for the menu "sent to", you do not need to operate on it in the registry. Its root cause is the "C:/Windows/sendto" folder, you only need to create a shortcut in this folder to point it to the folder you want to send, and it will be OK.

(6). Search

In Windows, the shortcut menu of a common folder and drive contains "search ......" This command, if we want to find accidentally deleted files in the recycle bin, and there are too many files in the recycle bin, we can add "search..." to the context menu of the recycle bin ......" This command. For details, refer to 2, 5. The subkey to be created is {61E218E0-65D3-101B-9F08-061CEAC3D50D }". But the command is changed to "file or folder ......"
After talking about this, you should know how to modify the right-click menu now? All of the above are accepted in the Chinese version of Windows 98. By studying this article, I believe that the rest of your work is how to perform registry operations and modifications in programming languages. No matter whether C # or JAVA is used, it is similar, finally, I wish you all a unique and handy shortcut menu. I hope you will visit my personal homepage at http://hi.csdn.net/ky178891 ,!

From: http://blog.csdn.net/ky178891/archive/2009/12/05/4948680.aspx

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.