Shell Folders Unit

   
Release: 2.3.2
Date: 11 January 2014
Delphi Compatibility:
D1 D2 D3 D4 D5 D6 D7 D2005 D2006 D2007 D2009 D2010 DXE DXE2 DXE3 DXE4
Red LED Red LED Red LED Grey LED Grey LED Grey LED Green 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 dialogue box. This component, which provides a wrapper round the Windows API SHBrowseForFolder function, permits a degree of customisation of the dialogue box. Features include:
  • The dialogue'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 dialogue box that is automatically disabled if the component's HelpContext or HelpKeyword properties are null. An OnHelp event can be used to customise help handling.
  • The dialogue box can be customised by handling the OnInitialise event.
  • The "New style" of Browse for Folder dialogue box can be displayed by setting an option. Such a dialogue box is resizeable and can display a Make New Folder button. Status text and the Help button cannot be displayed in the new style dialogue box.
  • Hints on using the dialogue 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 identify 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.

Compatibility

The Shell Folders Unit has been tested on Delphi 7 to XE4 Windows compilers (except Delphi 2005) and the Delphi XE2 to XE4 64 bit compilers. The unit is thought to compile on compilers back to Delphi 4, but that is not guaranteed.

The unit is use with the VCL only: it is not compatible with FireMonkey.

.NET and non-Windows platforms are not supported.

Some features require Delphi 6 and later and are not implemented when compiled with earlier compilers.

Documentation

The unit is documented online.

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 & Queries

If you find any bugs or want to suggest a new feature please report them using the Issue Tracker.

Click the Create Ticket button to create a ticket then complete the form giving as much information as possible. Please note: this issue tracker is shared among all the projects in the DelphiDabbler Code Library, so please make sure you enter shellfolders in the Project edit box. You should also choose Defect in the Type drop down list to report a bug or Enhancement to request a new feature.

If you have created a bug fix or have implemented a new feature please attach a zip file to your ticket that contains your source code.

Should you have any queries about using the components please read the documentation.

If you can't find an answer in the documentation then post a message in the discussion group.

Please do not email me or use the contact page to report bugs, ask for new features or to find out how to use the unit.
I'm afraid I have very limited time available to support the code library, and can't guarantee I'll find time for personalised advice.