Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#7

Re: wie bekomme ich den ordern: C:\Dokumente und Einstellung

  Alt 2. Apr 2007, 09:49
Zitat von toms:
Zitat von Luckie:
Die API-Version sollte zuverlässiger sein, denke ich.
Wie wärs mit SHGetSpecialFolderPath & CSIDL_APPDATA ?
Genau jene meinte ich.
Delphi-Quellcode:
function GetShellFolder(CSIDL: integer): string;
var
  pidl : PItemIdList;
  FolderPath : string;
  SystemFolder : Integer;
  Malloc : IMalloc;
begin
  Malloc := nil;
  FolderPath := '';
  SHGetMalloc(Malloc);
  if Malloc = nil then
  begin
    Result := FolderPath;
    Exit;
  end;
  try
    SystemFolder := CSIDL;
    if SUCCEEDED(SHGetSpecialFolderLocation(0, SystemFolder, pidl)) then
    begin
      SetLength(FolderPath, max_path);
      if SHGetPathFromIDList(pidl, PChar(FolderPath)) then
      begin
        SetLength(FolderPath, length(PChar(FolderPath)));
      end;
    end;
    Result := FolderPath;
  finally
    Malloc.Free(pidl);
  end;
end;
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat