Shell Folders Unit

   
Release: 2.3
Date: 29 January 2010
Delphi Compatibility:
 D1   D2   D3   D4   D5   D6   D7  D2005
(Win32)
D2006
(Win32)
D2007 D2009
(Win32)
D2010
(Win32)
Red LED Red LED Red LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED Green LED

Overview

This unit provides various components, classes and routines for handling Windows shell folders. Features are:

TPJBrowseDialog
A component that encapsulates the Windows Browse for Folder dialog box. This component, which provides a wrapper round the Windows API SHBrowseForFolder function, permits adegree of customisation of the dialog box. Features include:
  • The dialog's OK button can be enabled or disabled according to the currently selected folder.
  • Status text that changes with the currently selected folder can be displayed. This is done by setting an option and handling the OnSelChange or OnSelChangeEx events.
  • The PIDL of the currently selected folder is made available via the OnSelChangeEx event.
  • Virtual and file system folders can be displayed. The display can also be limited to file system folders only.
  • A help button can be included in the dialog box that is automatically disabled if the component's HelpContext or HelpKeyword properties are nul. An OnHelp event can be used to customise help handling.
  • The dialog box can be customised by handling the OnInitialise event.
  • The "New style" of Browse for Folder dialog box can be displayed by setting an option. Such a dialog box is resizable and can display a Make New Folder button. Status text and the Help button cannot be displayed in the new style dialog box.
  • Hints on using the dialog box can be displayed.
  • An edit control in which folder names can be entered can be displayed and actions taken when invalid folders are entered can be customised.
TPJShellFolderInfo
A component that provides information about a specified special shell folder. Information is extracted from the Windows SHGetSpecialFolderLocation function and is presented in a usable form via the component's properties.
TPJShellFolderEnum
A class that enumerates all the special shell folders (implements IPJShellFolderEnum below).
IPJShellFolderEnum
An interface to an object that enumerates all the special shell folders.
Support routines
Various routines are provided that can:
  • Manipulate special shell folder identifier information.
  • Extract display name and path information from PIDLs.
CSIDL_ Constants
Various CSIDL_ constants that are not provided by all versions of Delphi are declared. These indentify all known special folders or are flags that can be combined with special folder ids. MSDN provides information about these constants.
Property Editor
A separate design time unit contains a property editor for special shell folder identifiers. This property editor enables the object inspector to display shell folder constant names for relevant properties.

Documentation

The unit is documented in the Shell Folders Unit Wiki.

Users of Delphi versions 4 to 7 can also make use of the help file that is included in the download. It integrates with the Delphi 4-7 help system. The help file is a WinHelp file and therefore does not work on Windows Vista unless WinHelp has been downloaded and installed. See Microsoft Knowledge Base Article KB917607 for further information.

Demo program

A demo program is provided. It lists and provides information about all the special shell folders supported by the unit. A read-me file is included with the demo that explains further.

Feedback

If you find any bugs or want to suggest a new feature please report them using the Issue Tracker. If you have created a bug fix or have implemented a new feature please attach a zip file containing your source code.

If you have any other comments please contact me.