|
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.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|