1. Home
  2. Computing & Technology
  3. Delphi Programming

How to determine the path to the users Application Data

By Zarko Gajic, About.com Guide

For example, something that would return the string: 'C:\Documents and Settings\[username]\Application Data\', for the currently logged Windows user, when queried?

Valid only on Windows NT/2K/XP.

uses ShFolderPath;
...
function LocalAppDataPath : string;
const
   SHGFP_TYPE_CURRENT = 0;
var
   path: array [0..MAX_PATH] of char;
begin
   SHGetFolderPath(0,CSIDL_LOCAL_APPDATA,0,SHGFP_TYPE_CURRENT,@path[0]) ;
   Result := path;
end;

Delphi tips navigator:
» Hiding the cursor from the screen
« How to draw rotated text

Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2003 Delphi Tips
  7. Programmatically Determine the Path to the Users Application Data using Delphi

©2009 About.com, a part of The New York Times Company.

All rights reserved.