- slide 1 of 2
Custom Context Menu for Applications - Understanding Context Menu in Registry
Creating a Custom Context Menu for any application means altering or adding commands to the existing context menu. You can go about adding context menu to have your own commands in the custom context menu. You will be tweaking the registry editor to add custom context to aa menu.
Factors important for creating custom context menu are: file association or shell handlers (keys); verbs (keys); commands (keys), and Strings. Keys refer to items in left pane while strings are stored in the left pane of the registry. Strings are related to commands and contain information on the program to execute.
The very first key of the Windows Registry, HKEY_CLASSES_ROOT contains the different registered types and association handlers.
If you expand the key, you can see a list of file types registered on your computer. These are the file association handlers where you will place verbs to create your own custom context menu. For example, look for "HKEY_CLASSES_ROOT\txtfile" under the key and expand it to see the options. You can see Print, Printto, and Open - each having a sub-key, command that contains a command string in right pane.
The group HKEY_CLASSES_ROOT \Folder\ShellEx\ContextMenuHandlers applies your custom context menu to all Folders. HKEY_CLASSES_ROOT \SystemFileAssociations\Directory.Audio applies your custom context menu to all audio folders. Similarly, HKEY_CLASSES_ROOT\Excel.Template is meant for adding context menu to all MS Excel templates.
Before you begin tweaking the registry editor to add or remove options from custom context menu, you must know what are verbs and data. You also need to know the string (command line and parameters) about the applications for which you are creating custom context menu.
The best way is to research the HKEY_CLASSES_ROOT before starting to tweak the registry is to create a custom context menu.
IMPORTANT: Make sure you have a backup copy of the registry before you play around in the registry.
NOTE: All the items in the custom context menu and default context menu are present under Shell or ShellEx under different handles of HKEY_CLASSES_ROOT. If there is no Shell or ShellEx, it means there is no special context menu associated with that file type - though you can see the default context menu for the group (file group/folder).
- slide 2 of 2
Tweaking the Registry Editor to Create your own Custom Context Menu
As now you know that the main components of the context menu lie under the Shell and ShellEx keys of an application reference handler, you can start tweaking the registry editor by removing or adding your own commands. To remove a command, all you have is to delete the relevant key. Adding a command requires the knowledge of verb name. You have to add a verb and then data, which is often in form of a command line with unknown inputs (indicated by "%1").
Coming to keys for adding context menu, they are predefined strings that should always be put in quotes. If they are not in strings, the registry editor may assume Program as verb if the actual verb is "Program Name.exe" and will try to run Name.exe which is not present. Verbs are followed by a command with/out parameters as with printto.
The printto verb helps you print the selected file or folder simply by dragging it to a printer. You can specify the printer using "%1", "%2", "%3", depending upon how many printers you have.
Usage (Ref txtfile above): HKEY_CLASSES_ROOT\"Your Application"\SHELL \PRINTTO\ COMMAND
In the right pane, you will add the following string to Default for Command:
Path\MyApplication.exe /p "%1" "%2" (assuming you have two printers).
Among other common verbs are open, opennew (opens the object in new window), print, and properties.
NOTE: I recommend starting by tweaking the registry editor using simple file associations. Once comfortable, you can customize folders and file groups (Excel templates, Adobe products, etc).
Disclaimer: This article on tweaking the registry editor aims to offer you only an overview of how you can create a custom context menu. Please backup your registry before tweaking the registry. Bright Hub and this author will not be responsible for any damages arising as you learn to do tweaking of the registry editor.
Tweaking the Windows Registry - Custom Context Menu for Beginners
Tweaking the registry editor allows you more control over your machine and OS. This Guide helps you learn tweaking the registry editor to acheive the following: increase Windows Startup speed; increase Windows Shutdown, XP Registry Keys Best Backup Method ; and creating custom context menu;