Your application can extend the functionality of the operational environment provided by the system, also known as the shell, in a number of ways. A shell extension enhances the system by providing additional ways to manipulate file objects, by simplifying the task of browsing through the file system, or by giving the user easier access to tools that manipulate objects in the file system.
Note
Support for shell extensions may depend on the version of Windows installed. For more information about specific releases, see Appendix D, "Supporting Specific Versions of Windows."
Every shell extension requires a handler, special application code (32-bit OLE InProc server implemented as a dynamic-link library) that implements subordinate functions. The types of handlers you can provide include:
You register the handler for a shell extension in the HKEY_ CLASSES_ROOT key. The CLSID subkey contains a list of class identifier key values such as {00030000-0000-0000- C000-000000000046}. Each class identifier must also be a globally unique identifier.
Note
For more information about creating handlers and class identifiers, see the OLE documentation included in the Win32 SDK.
You must also create a shellex subkey under the application's class identification entry in the HKEY_CLASSES_ROOT key.
HKEY_CLASSES_ROOT
ApplicationIdentifier = Type Name
Shell [ = default verb [,verb2 [,..]]
...
shellex
HandlerType
{CLSID identifier} = Handler Name
...
HandlerType = {CLSID identifier}
The shell also uses several other special keys, such as *, Folder, Drives, and Printers, under HKEY_CLASSES_ROOT. You can use these keys to register extensions for system-supplied objects. For example, you may use the * key to register handlers that the shell calls whenever it creates a pop-up menu or property sheet for a file object, as in the following example.
HKEY_CLASSES_ROOT
* = *
shellex
ContextMenuHandlers
{00000000-1111-2222-3333-0000000001}
PropertySheetHandlers = SummaryInfo
{00000000-1111-2222-3333-0000000002}
IconHandler = {00000000-1111-2222-3333-000000003}
The shell would use these handlers to add to the pop-up menus and property sheets of every file object. (The entries are intended only as examples, not literal entries.)
A pop-up menu handler may add commands to the pop-up menu of a file type, but it may not delete or modify existing menu commands. You can register multiple pop-up menu handlers for a file type. The order of the subkey entries determines the order of the items in the context menu. Handler-supplied menu items always follow registered command names.
Keep in mind that if you want to include a command on the pop-up menu of every file of a particular type, you do not need to create and register a pop-up menu handler. You can just use the normal means of registering commands for that type. Create a pop-up menu handler only when you want to provide a command only under specific conditions, such as the length of the file or its timestamp.
When registering an icon handler for providing per-instance icons for a file type, set the value for the DefaultIcon key to %1. This denotes that each file instance of this type can have a different icon.