a component for detecting Windows system paths

TSystemPaths gets the system paths available for the Windows operating system. There are two properties for each directory. Firstly the property to check if the directory exists. If it exists the second property holds the directory itsself. The properties are read-only of course. The component is only a wrapper for some Windows API calls which you can find below with some links to the MSDN Library.


property name
value
WindowsDirectory
get it using GetWindowsDirectory
SystemDirectory
the API call is GetSystemDirectory
TempDirectory

You can get all other directories using the SHGetSpecialFolderPath function. It's important to put the shlobj-unit in your uses clause. The function itsself and the CSIDLs are defined there. In some Delphi® version you have to fix some minor problems. Some newer CSIDLs will not be defined, so you have to do this on your own. You may also see them in the demo application below:


CSIDL
value
CSIDL_MYMUSIC
$000D
CSIDL_MYPICTURES
$0027
CSIDL_MYVIDEO
$000E
CSIDL_PROGRAM_FILES
$0026
CSIDL_PROGRAM_FILESX86
$002A
CSIDL_PROGRAM_FILES_COMMON
$002B
CSIDL_PROGRAM_FILES_COMMONX86
$002C
CSIDL_COMMON_TEMPLATES
$002D
CSIDL_COMMON_DOCUMENTS
$002E
CSIDL_COMMON_APPDATA
$0023
CSIDL_COMMON_ADMINTOOLS
$002F
CSIDL_ADMINTOOLS
$0030

If you're wondering why it should be interesting to know this paths:
Microsoft tells you not to spread your application data all over Windows:

This function is provided primarily for compatibility. Applications should store code in the Program Files folder and persistent data in the Application Data folder in the user's profile.

To see the test results have a look at the screenshots of the test program.


Download info:
icon  Download the component as a ZIP file:
        mirror 1 is server online   download online     (file size: not determinable, last modified: not determinable)
        mirror 2 is server offline  
        mirror 3 is server online   download online     (file size: 17.27 kB, last modified: 22.09.2011)
icon  Download the component as a RAR file:
        mirror 1 is server online   download online     (file size: not determinable, last modified: not determinable)
        mirror 2 is server offline  
        mirror 3 is server online   download online     (file size: 14.56 kB, last modified: 22.09.2011)
icon  Download the DLL used by the component:
        mirror 1 is server online   download online     (file size: not determinable, last modified: not determinable)
        mirror 2 is server offline  
        mirror 3 is server online   download online     (file size: 93.00 kB, last modified: 21.09.2011)

Download info:
icon  Download the sample application as a ZIP file:
        mirror 1 is server online   download online     (file size: not determinable, last modified: not determinable)
        mirror 2 is server offline  
        mirror 3 is server online   download online     (file size: 320.73 kB, last modified: 22.09.2011)
icon  Download the sample application as a RAR file:
        mirror 1 is server online   download online     (file size: not determinable, last modified: not determinable)
        mirror 2 is server offline  
        mirror 3 is server online   download online     (file size: 257.38 kB, last modified: 22.09.2011)

If you're downloading the component be sure to put the helper unit in your unit search path.


last update: 2011-09-22 - 22:43:17.
copyright by Klaus Burgstaller 2011