Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 142257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:54:28+00:00 2026-05-11T07:54:28+00:00

Using Delphi, how do I access the equivalent of .NET’s System.Environment.SpecialFolder.LocalApplicationData variable (which works

  • 0

Using Delphi, how do I access the equivalent of .NET’s System.Environment.SpecialFolder.LocalApplicationData variable (which works on any version of Windows)? I assumed I could just do:

dir := GetEnvironmentVariable('LOCALAPPDATA'); 

This works on Vista but XP doesn’t seem to set that environment variable by default at least on my test machine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:54:28+00:00Added an answer on May 11, 2026 at 7:54 am

    In Delphi, the special system folder path constants are defined in ShlObj.DCU, and are referenced in the form of CSIDL_ followed by a symbolic name. Example:

    • CSIDL_DESKTOPDIRECTORY returns the path to the current desktop
    • CSIDL_PERSONAL is the My Documents directory
    • CSIDL___LOCAL_APPDATA is the (user name)\Local Settings\Application Data directory

    Here’s a quick function that will return the appropriate special folder path when given the symbolic name. Make sure you include the SHLOBJ.DCU unit in your USES statement, and use the following:

    function GetSpecialFolderPath(Folder: Integer; CanCreate: Boolean): string;  // Gets path of special system folders // // Call this routine as follows: // GetSpecialFolderPath (CSIDL_PERSONAL, false) //        returns folder as result // var    FilePath: array [0..255] of char;  begin  SHGetSpecialFolderPath(0, @FilePath[0], FOLDER, CanCreate);  Result := FilePath; end; 

    ================================================================

    For reference, the constants are as follows:

      CSIDL_DESKTOP                       = $0000; { <desktop> }   CSIDL_INTERNET                      = $0001; { Internet Explorer (icon on desktop) }   CSIDL_PROGRAMS                      = $0002; { Start Menu\Programs }   CSIDL_CONTROLS                      = $0003; { My Computer\Control Panel }   CSIDL_PRINTERS                      = $0004; { My Computer\Printers }   CSIDL_PERSONAL                      = $0005; { My Documents.  This is equivalent to CSIDL_MYDOCUMENTS in XP and above }   CSIDL_FAVORITES                     = $0006; { <user name>\Favorites }   CSIDL_STARTUP                       = $0007; { Start Menu\Programs\Startup }   CSIDL_RECENT                        = $0008; { <user name>\Recent }   CSIDL_SENDTO                        = $0009; { <user name>\SendTo }   CSIDL_BITBUCKET                     = $000a; { <desktop>\Recycle Bin }   CSIDL_STARTMENU                     = $000b; { <user name>\Start Menu }   CSIDL_MYDOCUMENTS                   = $000c; { logical 'My Documents' desktop icon }   CSIDL_MYMUSIC                       = $000d; { 'My Music' folder }   CSIDL_MYVIDEO                       = $000e; { 'My Video' folder }   CSIDL_DESKTOPDIRECTORY              = $0010; { <user name>\Desktop }   CSIDL_DRIVES                        = $0011; { My Computer }   CSIDL_NETWORK                       = $0012; { Network Neighborhood (My Network Places) }   CSIDL_NETHOOD                       = $0013; { <user name>\nethood }   CSIDL_FONTS                         = $0014; { windows\fonts }   CSIDL_TEMPLATES                     = $0015;   CSIDL_COMMON_STARTMENU              = $0016; { All Users\Start Menu }   CSIDL_COMMON_PROGRAMS               = $0017; { All Users\Start Menu\Programs }   CSIDL_COMMON_STARTUP                = $0018; { All Users\Startup }   CSIDL_COMMON_DESKTOPDIRECTORY       = $0019; { All Users\Desktop }   CSIDL_APPDATA                       = $001a; { <user name>\Application Data }   CSIDL_PRINTHOOD                     = $001b; { <user name>\PrintHood }   CSIDL_LOCAL_APPDATA                 = $001c; { <user name>\Local Settings\Application Data (non roaming) }   CSIDL_ALTSTARTUP                    = $001d; { non localized startup }   CSIDL_COMMON_ALTSTARTUP             = $001e; { non localized common startup }   CSIDL_COMMON_FAVORITES              = $001f;   CSIDL_INTERNET_CACHE                = $0020;   CSIDL_COOKIES                       = $0021;   CSIDL_HISTORY                       = $0022;   CSIDL_COMMON_APPDATA                = $0023; { All Users\Application Data }   CSIDL_WINDOWS                       = $0024; { GetWindowsDirectory() }   CSIDL_SYSTEM                        = $0025; { GetSystemDirectory() }   CSIDL_PROGRAM_FILES                 = $0026; { C:\Program Files }   CSIDL_MYPICTURES                    = $0027; { C:\Program Files\My Pictures }   CSIDL_PROFILE                       = $0028; { USERPROFILE }   CSIDL_SYSTEMX86                     = $0029; { x86 system directory on RISC }   CSIDL_PROGRAM_FILESX86              = $002a; { x86 C:\Program Files on RISC }   CSIDL_PROGRAM_FILES_COMMON          = $002b; { C:\Program Files\Common }   CSIDL_PROGRAM_FILES_COMMONX86       = $002c; { x86 C:\Program Files\Common on RISC }   CSIDL_COMMON_TEMPLATES              = $002d; { All Users\Templates }   CSIDL_COMMON_DOCUMENTS              = $002e; { All Users\Documents }   CSIDL_COMMON_ADMINTOOLS             = $002f; { All Users\Start Menu\Programs\Administrative Tools }   CSIDL_ADMINTOOLS                    = $0030; { <user name>\Start Menu\Programs\Administrative Tools }   CSIDL_CONNECTIONS                   = $0031; { Network and Dial-up Connections }   CSIDL_COMMON_MUSIC                  = $0035; { All Users\My Music }   CSIDL_COMMON_PICTURES               = $0036; { All Users\My Pictures }   CSIDL_COMMON_VIDEO                  = $0037; { All Users\My Video }   CSIDL_RESOURCES                     = $0038; { Resource Directory }   CSIDL_RESOURCES_LOCALIZED           = $0039; { Localized Resource Directory }   CSIDL_COMMON_OEM_LINKS              = $003a; { Links to All Users OEM specific apps }   CSIDL_CDBURN_AREA                   = $003b; { USERPROFILE\Local Settings\Application Data\Microsoft\CD Burning }   CSIDL_COMPUTERSNEARME               = $003d; { Computers Near Me (computered from Workgroup membership) }   CSIDL_PROFILES                      = $003e; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.