Thema: Delphi Application Path

Einzelnen Beitrag anzeigen

hathor
(Gast)

n/a Beiträge
 
#27

AW: Application Path

  Alt 8. Okt 2013, 07:13
WIN 8:

Delphi-Quellcode:
uses
  ActiveX, ShlObj;

function SpecialDirectory(const iID: Integer): string;
var aPath : array[0..MAX_PATH] of Char; pilTemp: PItemIDList;
begin
   try
      if SHGetSpecialFolderLocation(0, iID, pilTemp)=S_OK then begin
         if SHGetPathFromIDList(pilTemp, aPath) then begin
            Result := string(aPath);
         end else Result := ''; CoTaskMemFree(pilTemp);
      end else Result := '';
   except Result := '';
   end;
end;

function GetConfigPath: String;
var AppDir: String;
begin
  AppDir := SpecialDirectory(CSIDL_APPDATA)+'\ProgName';
  if DirectoryExists(AppDir) = false then mkdir(AppDir);
    result := AppDir+'\';
end;

//ergibt: C:\Users\HATHOR\AppData\Roaming\ProgName\
Hinweis:
Über den WIN8-Explorer kommt man nur hin, wenn man
C:\Users\HATHOR\AppData\Roaming\ProgName\
direkt in die Adresszeile eingibt.


Alternativ: Im Explorer - Ansicht - Häkchen bei Ausgeblendete Elemente

Geändert von hathor ( 8. Okt 2013 um 08:50 Uhr)
  Mit Zitat antworten Zitat