Modifying the Context Menu for a File Class
When the user clicks a file object using mouse button 2, the system displays a
context menu for the object. The context menu contains a set of menu items
that allow the user to perform various operations on the file object, such as
opening or printing it. A context menu contains two types of items: dynamic items
and static items. Dynamic items are added to a context menu by a context menu
handler.
Static menu items are listed in the system registry and are automatically
added to a context menu by the system. Because static items are listed in the
system registry based on their class, the context menus for all file objects
belonging to a particular class receive the same set of static items.
You specify static menu items for a file class by adding a
shell key below the application identifier key of the file class and then adding
verb and command value entries below the shell key. Following is the registry
format for static items.
HKEY_CLASSES_ROOT
<applicationID> = <"description">
shell
<verb> = <"menu-item text">
command = <"command string">
Each verb value entry specifies a menu-item text string for the system to add
to the context menu. The command
value entry specifies the action that the system takes when the user chooses
the menu item. Typically, the
command string value specifies the path and filename of an application and includes
command-line options that direct the application to perform an action on the
corresponding file object. For example, the following registry keys add an Open command
and a Print command to the context menu for all files with the .WRI filename
extension.
HKEY_CLASSES_ROOT
wrifile = Write Document
shell
open
command = C:\Progra~1\Access~1\WORDPAD.EXE %1
print
command = C:\Progra~1\Access~1\WORDPAD.EXE /p "%1"
printto
command =
C:\Progra~1\Access~1\WORDPAD.EXE /pt "%1" "%2" "%3" "%4"
In the preceding commands, the %1 parameter is the filename, %2 is the printer
name, %3 is the driver name, and %4 is the port name. In Windows 95, you can
ignore the %3 and %4 parameters (the printer name is unique in Windows 95).
The system defines a set of verbs called
canonical verbs that introduce an element of language-independence to context menus. When you
include a canonical verb in the registry, the system automatically generates a
localized menu item string for the verb before adding it to the context menu.
The canonical verbs include the open, print, explore, find, openas, and
properties verbs. The printto verb is also canonical, but it is a special case because
it is never actually displayed. Instead, it allows the user to print a file by
dragging it to a printer object. Canonical verbs are also used with context
menu handlers.
If the open canonical verb is included in the registry entries for a file
class, the system adds an Open menu item to the corresponding context menu and
makes it the default item. If the open verb is not included, the menu item
corresponding to the verb listed in the registry is the default item. A context menu
handler can change the default item. For more information about context menu
handlers, see
Context Menu Handlers.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database