Autor Beitrag
sascha2005
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25

WinXP
D7
BeitragVerfasst: Mi 28.06.06 22:41 
ich habe diese funktion

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
  function GetFileAttributes(const FileName: String): TFileAttributes;
  var srec: TSearchRec;
  begin
    result := [];
    if FindFirst(FileName, faAnyFile, srec) = 0 then begin
      try
        if (srec.Attr and faReadOnly) > 0  then result := result + [ReadOnly];  //Schreibgesch. Datei
        if (srec.Attr and faHidden) > 0    then result := result + [Hidden];    //Verborgene Datei
        if (srec.Attr and faSysFile) > 0   then result := result + [SysFile];   //Systemdatei
        if (srec.Attr and faVolumeId) > 0  then result := result + [VolumeId];  //Laufwerks-ID
        if (srec.Attr and faDirectory) > 0 then result := result + [Directory]; //Verzeichnis
        if (srec.Attr and faArchive) > 0   then result := result + [Archive];   //Archivdatei
        if (srec.Attr and faAnyFile) > 0   then result := result + [AnyFile];   //Beliebige Datei
      finally
        FindClose(srec);
      end;
    end;
  end;

  // wird aufgerufen mit
  FileAttribute := GetFileAttributes(PathPlusFilename);


so...
nun habe ich FileAttribute und will das in die ListView packen.
aber wie wandel ich das FileAttribute in String um?
damit ichs so reinpacken kann: ListView1.Items[i].SubItems.Add(?FileAttribute?); // Type der Datei
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mi 28.06.06 22:55 
Hallo,

änder doch die Funktion z.B:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
function GetFileAttributes(const FileName: String): String;  
  var srec: TSearchRec;  
  begin  
    result := '';  
    if FindFirst(FileName, faAnyFile, srec) = 0 then begin  
      try  
        if (srec.Attr and faReadOnly) > 0  then result := result + 'R';  //Schreibgesch. Datei  
        if (srec.Attr and faHidden) > 0    then result := result + 'H';    //Verborgene Datei  
        if (srec.Attr and faSysFile) > 0   then result := result + 'S';   //Systemdatei
       //...
      finally  
        FindClose(srec);  
      end;  
    end;  
  end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
sascha2005 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25

WinXP
D7
BeitragVerfasst: Mi 28.06.06 23:10 
besten dank !
es funzt :D
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mi 28.06.06 23:25 
Übrigens: AnyFile ist nur eine Kombination der häufigsten Flags und kein Attribut im eigentlichen Sinne.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.