Add your own program to the Windows right-click menu [Reprint]

Source: Internet
Author: User
Tags compressed file types ultraedit

Original link: http://blog.csdn.net/marklr/article/details/4006356
Add your own program to the Windows right-click menuTags: windowsattributes extended commandshell Documentation2009-03-20 08:443369 People readComments (1) CollectionReportCategory:BCB (a)

Modifying the context menu should be in the registry, specifically, under the HKEY_CLASSES_ROOT root key (here is the root of all commands in the right-click menu Oh!). )。 To expand the root key, there are two main subkeys under it: the extension key (. + extension) and the class definition key. Generally, as long as it is a registered extension in the Windows system, under the HKEY_CLASSES_ROOT has "• The extension" subkey, some information about the extension, the right-click menu for a particular type of file modification, is the key or "extension file" key operation.
One, add commands in the right-click menu of all Files
If you have WinZip, UltraEdit, and so on on your system, there are commands like "Add to zip" and "UltraEdit-32" When you right-click on any of the files (of course, WinZip is slightly different, I'll talk about it later). It is added by:
1. Open "hkey_classes_root/*";
2. Under it, create a new "shell/Command/command" Branch, and then set the command's key value to the absolute path of the executable program used to execute it, and then add "%1".
Example: In "Hkey_classes_r
oot/* "New" shell/with WordPad open/command "subkey, set command key value to" C:/windows/notepad.exe%1 ", will appear in the right-click menu" Open with WordPad "command.
Description: 1. To delete this type of command, simply delete the "command" sub-key;
2. Some people may ask him to do what I write, but the reason for getting it is somewhat different from mine, which is that my command has a shortcut key (N), as long as "open with WordPad" after "(& N) "Can.

Ii. adding commands to the right-click menu for a specific file type
Just mentioned Winzip this software, for the normal file type, its right-click menu has "Add to zip", but to its supported compressed file types, such as *.zip, *.cab, *.rar in its right-click menu has "Open with Winzip", "Extract To, ' Extract to Folder ', ' Create self-extractor (. EXE) ', for self-extracting installation files (such as oicq99b), the "Run with Winzip" command in the right-click menu. Here is the command Add method for the right-click menu for a specific file type (for example, play with Winamp in the context menu of the mp3 file):
1. Open the "hkey_classes_root/mp3_auto_file" primary key;
2. Under the new "Shell/play with Winamp" (& P)/command ", set the command's key value to" C:/Program files/winamp/winamp.exe%1 ".
Note: When more than one software can play the mp3 file, we can add multiple commands in the right-click menu, such as "Play with Unreal", but how do we define a command as the default action (that is, the Bold command in the right-click menu)?
You must say, very simple thing! Move the mouse to a MP3 file, press SHIFT while pressing the right mouse button, select "Open with" in the right-click menu to change, but this is wrong, do not believe you try, so only in the right-click menu "Open" will only use the program you choose to open it, otherwise, it still as always. Because its default action is not to "open" this command. The real way is to change the shell's default key value to the command you want to execute, such as changing the shell's key value to "Winamp".
Also, do not know that you found no, I used in the previous example is "Play with Winamp" command, and here is the "Winamp", is not a bit of a corresponding? Speaking of this, it really makes me sad, originally i in the TXT document with the shell for the default operation of the conversion (convert open and print) quite successful, but a conversion "play with Winamp" and "Play with Unreal" failed, always converted, and finally Understand that this may be a bug in the "Plague Bar", which requires that the primary key be converted to a single string when the key name is valid. The combination of Chinese characters and English is also valid, but there can be no space in the middle (I do not know if this is related to my Win98 is the D version?). )。
If you think the above method is inconvenient and too complex, in fact, Windows also provides a more convenient and secure way to not operate the registry: Open a folder, select "View/Folder Options/File Type", here you will find all the registered file types, select "MP3 File/edit" , see the "New", "edit", "delete", "Set as Default" buttons below the actions below? Four. No, I'll teach you again! Hey.

Third, add commands in the right-click menu of all folders
If you have used acdsee this software, you will find that in the folder's right-click menu there is always "Browse with ACDSee" This command, the same kind of Pc-cillin trend Pc-cillin 98 command, the following additional methods of the class command:
1. Open the "Hkey_classes_root/diretory/shell" primary key;
2. Under the new "Command/command" ... Let's not talk about it!
Note: 1. If you are careful, you will find the actual drive in the right-click menu, but also "Browse with ACDSee" "Trend pc-cillin98" and other commands, the drive is a special folder, but through the above method is not in the drive's right-click menu to add into the command. If you want to add a command in it, the "Hkey_classes_root/drive/shell" primary key must be manipulated;
3. Under the "HKEY_CLASSES_ROOT" primary key there is also a folder sub-key, as the name implies, the operation on it will affect all folders, including the Recycle Bin, remember!

Iv. Add commands to the right-click menu of all files and folders
If you develop a program yourself, it's working with files and folders, so you want to add specific commands to all the files and folders in the right-click menu, which depends on the following.
Open the "hkey_classes_root/allfilesystemobjects" primary key, under which you create a new "shell/command/command", and the following actions are the same as before.
It should be pointed out that this is only a solution, if you look at my captured figure, you will find that there is always a "iconview" command, appear in all the files and folders in the right-click menu, but this is not formed in this way, you might as well contrast, This command is extended by the application extension library Iv_shext.dll in the software, so it appears in the middle of the right-click menu. Instead of at the top. What Let me talk about this method? Since this approach involves programming, confined to space and subject matter, I'm not going to talk about this method (Shh!). Be quiet, I'm not. )

V. Additions and deletions of some special commands
1. Explorer
In Windows system, there is an "explorer" command in the right-click menu for normal folders, drives, recycle bins, and so on, if you want to keep the command only in the drive, you can first delete the Explore subkey in the "Hkey_classes_root/folder/shell" PRIMARY key , and then create a new "Explore/command" subkey in the "Hkey_classes_root/drive/shell" primary key, so that the Commmand key value is "c:/windows/explorer.exe/e,/idlist,%i ,%l "How, Success!"
2. Empty the Recycle Bin
In the Windows system, only in the Recycle Bin in the right-click menu has "empty Recycle Bin" command, is not too inconvenient, OK, we can undergo a transformation, so that all the File menu has "empty Recycle Bin" command, follow me!
Our idea is to find out the source of the "Empty Recycle Bin" command, and then copy it to "hkey_classes_root/*". Good, or first to find it, I find AH find, finally found! --to teach you a few special commands (especially software provided by third parties), which is the Application extension library (.   DLL), you can find traces of it in the "Shellex/contextmenuhandlers" registry. We open "hkey_classes_root/clsid/{645ff040-5081-101b-9f08-00aa002f954e}/shellex/contextmenuhandlers" and we can see that there is a "{ 645FF040-5081-101B-9F08-00AA002F954E} ", which is the root of the" Empty Recycle Bin "command.
Find the source, it is much easier, under "hkey_classes/root/*/shellex/contextmenuhandlers" a new key named "{645ff040-5081-101b-9f08-00aa002f954e}" The sub-keys, how, cool enough!
3. Adding and removing subcommands for new commands
Do not know if you have encountered this situation: you often manually write Web pages, in the unit of the new command on the machine has the "New HTML Document" command, but your machine is not, and, with the increasing variety of software, your new command pop-up command more and more time, a lot of it! It doesn't matter, don't worry, let me help you to get out of the call out, should not come to 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, you now right-click on the desktop, see New, is not a bit more what? As for the deletion, I do not want you to let me say more!
4. Adding commands such as cut, copy, paste, etc.
Note that I just talk about the addition of commands such as Cut, copy, paste and so on, which means that some objects that do not have these commands in the right-click menu can be added, and for those objects that already have these commands, I can't even delete them.
OK, I now take the Recycle Bin as an example, to cut, copy, paste and other commands to add, specifically, there are "open, cut, copy, paste, rename, delete, attributes," and other commands to add. First open the "hkey_classes_root/clsid/{645ff040-5081-101b-9f08-00aa002f954e}" PRIMARY key, you will find that there are "ShellFolder" sub-keys, The new binary value attributes is created under this subkey, and its key value determines the display and hiding of these commands in the right-click menu. Specific as follows:
Command Key value
Open 00 00 00 20
Cut 02 00 00 00
Replication 01 00 00 00
Paste 00 01 00 00
Delete 20 00 00 00
Renaming 10 00 00 00
Property 40 00 00 00
If you want to display some commands, simply add the corresponding key values for the command, and the result will be the key value of the attributes. For example: When the attributes value is 00 00 00 00 (default), the above command is not displayed, and when 73 01 00 20 o'clock, all commands are displayed. Now, you can change the "Recycle Bin" to the name you want to change, and you can paste the "waste" into the Recycle Bin (but I don't see how much it works, right?). )
5. "Send To" and its menu
Some folders (such as My Documents) in the right-click menu do not have "send to" this command, we can add to it, the method can refer to the "Empty Recycle Bin" command to add methods. is to open "Hkey_classes_root/clsid/{450d8fba-ad25-11d0-98a8-0800361b1103}/shellex/contextmenuhandlers", under which you create a new "{ 7ba4c740-9e81-11cf-99d3-00aa004ae837} "sub-key, it's OK.
As for the "Send to" menu, it does not need to operate in the registry, it is the root of the "C:/windows/sendto" folder, you just need to create a new shortcut in this folder, so that it points to the folder you want to send, OK.
6. Find
In the Windows system, the normal folder and the drive's right-click menu has "find ..." this command, if we want to find in the Recycle Bin deleted files, and at this time there are more files in the Recycle Bin, we can add "find ..." in the Recycle Bin right-click menu. The specific method can be referenced in 2, 5. Just need to create a new subkey of "{61e218e0-65d3-101b-9f08-061ceac3d50d}". But the command becomes a "file or folder ..."

Add your own program to the Windows right-click menu [Reprint]

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.