Ergebnis des untenstehenden Codes:
C:\Users\HATHOR\AppData\Roaming\MyProg
Delphi-Quellcode:
function GetMyPath: string;
var LStr: array[0 .. MAX_PATH] of Char;
s, AppDir : String;
begin
Result:='';
Application.Name:='MyProg';
s:= PathDelim + Application.Name;
SetLastError(ERROR_SUCCESS);
if SHGetFolderPath(0, CSIDL_APPDATA, 0, 0, @LStr) = S_OK then
AppDir:= LStr +s;
Result := AppDir;
if not DirectoryExists(AppDir) then mkdir(AppDir);
end;