April 2, 2008
Wednesday

Last updated
Software Professional August 28, 1998
Friday

Site founded
  for people and PCs

Contents Fast Explorer
Search the site:

Shell Reference

The Microsoft® Windows® user interface (UI) gives users access to a wide variety of objects necessary for running applications and managing the operating system. The most numerous and familiar of these objects are the folders and files that reside on computer disk drives. There are also a number of virtual objects that allow the user to do tasks, such as send files to remote printers or access the Recycle Bin.

The shell organizes these objects into a hierarchical structure called the namespace, which provides users and applications with a consistent and efficient way to access and manage objects. Users interact with the namespace through the shell's graphical UI or through an application. Applications interact with the namespace through the shell's application programming interface (API).

File Classes

Files with a common file name extension can be defined as members of a file class. Defining a file class allows to extend the shell by customizing the behavior of all files in the class. The folowing behaviors can be customized by adding registry entries or special files:

  • Specifying the application used to open the file when it is double-clicked.
  • Adding commands to the context menu.
  • Specifying a custom icon.

For a greater degree of control over the behavior of a file class, there are shell extension handlers.

Context Menu Handlers

When a user right-clicks a shell object, the shell displays its context menu. For file system objects there are a number of standard items, such as Cut and Copy, that are on the menu by default. If the object is a file that is a member of a class, additional items can be specified in the registry (static menu items). Finally, the shell checks the registry to see if the file class is associated with any context menu handlers. If it is, the shell queries the handler for additional context menu items (dynamic menu items).

A context menu handler is a shell extension handler that adds commands to an existing context menu. Context menu handlers are associated with a particular file class and are called any time a context menu is displayed for a member of the class. While you can add items to a file class context menu with the registry, the items will be the same for all members of the class. By implementing and registering such a handler, it is possible to dynamically add items to an object's context menu, customized for the particular object.

Predefined Shell Objects

The shell defines additional objects under HKEY_CLASSES_ROOT which can be extended in the same way as file types. The following table gives the various subkeys of HKEY_CLASSES_ROOT that extension handlers can be registered under.

Subkey Description Version
* All files All
AllFileSystemObjects All files and file folders 4.71
Folder All folders All
Directory File folders All
Directory\Background File folder background 4.71
Network Entire network (under My Network Places) All
Network\Type\# All objects of type # (see below) 4.71
NetShare All network shares 4.71
NetServer All network servers 4.71
network_provider_name All objects provided by network provider "network_provider_name" All
Printers All printers All
AudioCD Audio CD in CD drive All
DVDFile DVD drive (Windows 98) 4.71
DVD DVD drive (Windows 2000) 4.71

Notes:

  • The file folder background context menu is accessed by right-clicking within a file folder, but not over any of the folder's contents.
  • For Network\Type\#, "#" is a network provider type code in decimal. The network provider type code is the high word of a network type.
  • "network_provider_name" is a network provider name with the spaces converted into underscores. For example, if the Microsoft Networking network provider is installed, its provider name is "Microsoft Windows Network", and the corresponding network_provider_name is Microsoft_Windows_Network.
  • Predefined shell objects depends on Windows and shell versions. Fast Explorer handles these version differences automatically.

Information source: MSDN Library.


Copyright © 1998-2004 Alex Yakovlev & Serge Kolesnikov
Copyright © 2004-2007 Alex Yakovlev
All rights reserved. Mentioned trademarks are trademarks of their respective owners.