Autor Beitrag
DXC
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 61

WINXP + SP2
D6 Pers, D2005 Pers
BeitragVerfasst: So 07.08.05 15:25 
Hi,


ich weiß... FindFirst, FindNext, FindWasWeißIch. Leider komm ich mit dem nicht zurecht kann mir jemand helfen wie ich es machen kann das alle ordner in einem ordern z.b in einem Memo Feld angezeigt werden können ?


Wäre DAnkbar

MFG
DXC


Moderiert von user profile iconraziel: Topic aus VCL (Visual Component Library) verschoben am Di 04.10.2005 um 09:36
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: So 07.08.05 15:27 
Hi,

wie währe es, wenn du einfach sagst, was du bei FindFirst, FindNext und FindClose nicht verstehst? Dann können wir dir vielleicht damit helfen.

Gruß
Klabautermann
DXC Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 61

WINXP + SP2
D6 Pers, D2005 Pers
BeitragVerfasst: So 07.08.05 16:17 
Hi,

Ich habs mal so gemacht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.FormCreate(Sender: TObject);
var
  pfad: string;
  ordner: string;
begin
  pfad := 'C:\';
  ordner := FindFirst(pfad, faAnyFile);
  memo1.text := ordner;                           // Nur als beispiel ...
end;

end.


Hab ich aus der Delphi-Hilfe (wobei ich dort die hälfte net verstanden hab :oops: )
Sorry aber bin dich noch kein Profi... :oops:


MFG
DXC
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: So 07.08.05 16:50 
user profile iconDXC hat folgendes geschrieben:
Hab ich aus der Delphi-Hilfe (wobei ich dort die hälfte net verstanden hab :oops: )


Das glaub ich nicht :roll: also, dass das in der Delphihilfe steht.
Aber das dürfte dir helfen: dsdt.info/tipps/?id=503

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 07.08.05 16:58 
ExtractFilePath(ParamStr(0)) ist der Pfad wo deine Exe liegt, den musst Du noch anpassen.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.Button1Click(Sender: TObject);
var SR: TSearchRec;
    Pfad:String;
begin
  Pfad:=ExtractFilePath(ParamStr(0)); 
  if (FindFirst(Pfad+'*.*',faDirectory,SR)=0) then
  begin
    repeat
      if (SR.Name<>'.') and (SR.Name<>'..') and (faDirectory and Sr.Attr = fadirectory ) then
      begin
        Memo1.Lines.Add(SR.Name);
      end;
    until FindNext(SR)<>0;
    FindClose(SR);
    end;
end;
klezmor
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Sa 01.10.05 15:23 
Das hat jetzt zwar sehr gut bei mir funktioniert, aber verstanden habe ich die suchprocedur nicht richtig, könnte mir das viellcihet jemand schritt für schritt erklären?
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Di 04.10.05 06:58 
Guten Morgen!

Ich kommentiere mal den Source:

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:
25:
26:
27:
28:
29:
procedure TForm1.Button1Click(Sender: TObject);
var SR: TSearchRec;
    Pfad:String;
begin
  // Die Variable Pfad bekommt das Verzeichnis zugewiesen in 
  // dem sich die Anwendung befindet.
  Pfad:=ExtractFilePath(ParamStr(0));
 
  // Jetzt wird versucht den erste Ordner in dem Verzeichnis Pfad
  // zu finden. Wenn das geklappt hat ...
  if (FindFirst(Pfad+'*.*',faDirectory,SR)=0) then
  begin
    repeat
      // ... dann wird zu erst geprüft ob der Ordnername nicht "." und 
      // nicht ".." ist und ob es sich bei dem gefundenen Eintrag auch um
      // einen Ordner handelt.
      if (SR.Name<>'.') and (SR.Name<>'..') and (faDirectory and Sr.Attr = fadirectory ) then
      begin
        // Wenn die drei Prüfungen wahr sind wird der Ordner in die Memo-
        // Komponente eingetragen.
        Memo1.Lines.Add(SR.Name);
      end;
    // Jetzt wird geschaut ob es noch einen weiteren Ordner 
    // gefunden werden kann. Wenn ja wird die Repeat-Anweisung
    // wiederholt.
    until FindNext(SR)<>0;
    FindClose(SR);
    end;
end;


Ich hoffe damit konnte ich dir etwas helfen. Mehr zu den einzelnen Funktionen findest du aber in der Delphi-Hilfe und hier im Forum!

Lg Martin