Chapter Fourteen: The Shell Name Space

In this final chapter, we'll discuss the shell name space and how developers can take advantage of some of the built-in browsing functions in Microsoft Windows 95. The ability to browse the shell name space lets you scan, locate, or display information about the directory structure of the system or about particular folders.

The shell name space is a collection of symbols, such as filenames, directory (folder) names, or database keys. The system stores all these objects and others in a hierarchical structure and uses Windows Explorer to display the information. At the root of this structure is the desktop.

A developer not as savvy as you are might say, “So what? This is just a glorified directory structure.” Bzzt! Thanks for playing. Next contestant, if you please.

The shell name space does include file system information, but it contains much more than files and folders. It also includes network resources, printers, Control Panel applications, the Recycle Bin, and so on. This arrangement makes it easy for the user to find an object without having to understand the underlying directory structure of the file system. Figure 14-1 on the next page, for instance, from the ENUMDESK sample (written by Greg Keyser), displays the contents of a Control Panel folder.

This chapter presents two samples that demonstrate how to use built-in functions to browse the shell name space. The first sample, Greg Keyser's ENUMDESK, is written in C using the Win32 API. The second sample is MFCENUM, the version I ported to MFC. In Figure 14-2, also on the next page, you can see the ENUMDESK main window. Looks like Windows Explorer, doesn't it?

Figure 14-1.

The contents of a Control Panel folder.

Figure 14-2.

The ENUMDESK main window.