Autor Beitrag
rizor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Mo 16.04.07 19:09 
Hi,

wie kann ich einen Ordner nach Dateien durchsuchen und die gefundenen Dateien in dieser ValueList ausgeben?
Ich weiß leider überhaupt nicht, wie ich einen Ordner nach bestimmten Dateiendungen durchsuchen kann.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.04.07 19:16 
Moin!

Suche in: Delphi-Forum, Delphi-Library DRIVETOOLS, '*.mp3' und TStringList.Values[] in der DOH nachschlagen. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Mo 16.04.07 19:38 
Es handelt sihc aber um eine TValueListEditor und nicht um eine TStringlist
Dunkel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 682

Mac OS X Snow Leopard
Xcode 3.1
BeitragVerfasst: Mo 16.04.07 20:25 
Das hast Du schon im ersten Beitrag erwähnt.

Der TValueListEditor benutz TStrings zum Speichern/Verwalten der Einträge...

_________________
Ich streite einsam mich mit dieser Oberflächenwelt
Gutes sei ein löblich Brot von dem ich zehre - bis zum Tod [Das Ich - Im Ich]
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Mo 16.04.07 21:21 
Aber wenn ihc dass dann so mache, dann bekomme ihc keine Ausgabe.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
Procedure TGameFiles.FindFiles (aPath, aFindMask: String; aResult: tStrings);
Var
  FindRec: tSearchRec;
Begin
  // Wenn die Stringliste nil ist oder aPath oder aFind nicht angegeben ist
  // dann raus
  If (aPath = ''or (aFindMask = ''or Not Assigned (aResult) Then
    Exit;

  // Wenn am Ende der Pfadangabe noch kein \ steht, dieses hinzufügen
  // (Oder die Funktion  IncludeTrailingPathDelimiter aus der Unit SysUtils.pas verwenden)
  If aPath[Length (aPath)] <> '\' Then
    aPath := aPath + '\';

  // Im aktuellen Verzeichnis nach der Datei suchen
  If FindFirst (aPath + aFindMask, faAnyFile, FindRec) = 0 Then
    Repeat
      If (FindRec.Name <> '.'and (FindRec.Name <> '..'Then
        // ...Ergebnis in die Stringlist einfügen
        aResult.Add (aPath + FindRec.Name);
    Until FindNext (FindRec) <> 0;

  FindClose (FindRec);
End;


Und der Aufruf sieht folgender Maßen aus:

ausblenden Delphi-Quelltext
1:
FindFiles('.am', GetApplicationDirectory, ListSpielstand.Strings);					


Wieso funktioniert die Ausgabe jetzt nicht?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.04.07 23:09 
user profile iconNarses hat folgendes geschrieben:
TStringList.Values[] in der DOH nachschlagen.
:roll:

_________________
There are 10 types of people - those who understand binary and those who don´t.