OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
About the Shell Classes

The shell classes allow a program to navigate the Windows 95 shell hierarchical namespace.

The shell namespace consists of objects such as files, directories, drives, printers, and networked computers. The root of this hierarchical namespace is the desktop.

In OWL's shell classes, every object in the shell namespace is a TShellItem. If an object is a folder and/or it contains sub-folders, an iterator (of type TShellItemIterator) can be created on it to iterate through its contents.

Before any shell navigation can take place, an initial TShellItem must be created. This initial TShellItem can be any file or directory in the file system, or any special folder such as the Desktop, the Recycle Bin, the Control Panel, or My Computer.

Using the Shell Classes

The general strategy is to:

  1. Create TShellItem for the object (or objects) of interest.
  2. Use the TShellItem member functions to access the object properties.

The following example shows how to display the names of the items in a folder, and its sub-folders:

  1. Create an TShellItem for the c:\users folder.
    TShellItem folder ("c:\\users");
  2. Create an initialized TShellItem for the iterator.
    TShellItem item;
  3. Iterate through the folder and display the item name.
    for (TShellItemIterator i(folder); i.valid();)
    {
    item = i++;
    MessageBox (0, item.GetDisplayName(), "Title", MB_OK);
    }