Compartilhar via


Extending Shortcut Menus for a File Class (Windows CE 5.0)

Send Feedback

A file class consists of files with common file name extensions. Defining a file class allows you to extend the Shell by customizing the behavior of all the member files in the class.

You can extend the shortcut menu for a file class by creating a registry entry for each command. Right-clicking a file in the Shell usually pops up the shortcut menu. The shortcut menu contains a list of commands that the user can select to perform various actions on the file. Each command on the shortcut menu is identified in the registry by its verb. A verb is a simple text string that is used by the Shell to identify the associated command. Each verb corresponds to the command string that is used to launch the command.

The file class must be registered before you can extend its context. To register a file class, add a Shell subkey below the key for the ProgID of the application that is associated with the file class. Below the Shell subkey, create one subkey for each verb you want to add. Each of these subkeys will have a REG_SZ value set to the verb's display string. For each verb subkey, create a command subkey with the default value set to the command string.

Shortcut menu verbs are the same as those used by ShellExecuteEx when you launch applications programmatically. The verbs available for a file object are the items that you find on a file's shortcut menu. To find the verbs that are available, look in the registry under

HKEY_CLASSES_ROOT\<object_name>\Shell\<verb>

object_name is the name of the file object and verb is the name of the available verb. The verb subkey contains the data that indicates what happens when that verb is invoked.

Verbs can also have a display string associated with them. This is displayed on the shortcut menu instead of the verb string itself.

Each verb corresponds to the command that would be used to launch the application from a console window. The open verb is a good example, because it is commonly supported. For .exe files, open launches the application. However, it is more commonly used to launch an application that operates on a particular file. For instance, .txt files can be opened by Microsoft® WordPad. The open verb for a .txt file corresponds to the following command:

"C:\Program Files\Windows NT\Accessories\Wordpad.exe" "%1"

When you use ShellExecuteEx to open a .txt file, Wordpad.exe is launched with the specified file as its argument. Some commands can have additional arguments, such as flags, that can be added, as needed, to launch the application properly.

See Also

Shell Application Development | SHELLEXECUTEINFO | ShellExecuteEx

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.