Thema: Delphi SelectDirectory Problem

Einzelnen Beitrag anzeigen

TK S 22

Registriert seit: 12. Aug 2009
8 Beiträge
 
#16

Re: SelectDirectory Problem

  Alt 12. Aug 2009, 20:28
Funkt aber irgendwie nicht.
Delphi-Quellcode:
procedure TForm2.Button1Click(Sender: TObject);
begin
  SelectDirectory ('Choose Directory', '', pfad);
  if SelectDirectory ('ChooseDirectory', '', pfad)
  then Label1.Caption := (pfad)
  else Showmessage ('Cancelled');

end;
procedure FindAllFiles(pfad: string; Mask: string = '*.txt'; Recurse: Boolean = True); //inkompatible typen strings und Tstrings
begin
 pfad := IncludeTrailingPathDelimiter(pfad);
 if Recurse then
    if FindFirst(pfad + '*.txt', faAnyFile, SR) = 0 then
    try
      repeat
        if SR.Attr and faDirectory = faDirectory then
      if (SR.Name <> '.') and (SR.Name <> '..') then
            FindAllFiles(FileList, pfad + SR.Name, Mask, Recurse); //inkompatible Typen Boolean und string
      until FindNext(SR) <> 0;
    finally
      FindClose(SR);
    end;
  if FindFirst(pfad + Mask, faAnyFile, SR) = 0 then
  try
    repeat
      if SR.Attr and faDirectory <> faDirectory then
      begin
        FileList.Add(pfad + SR.Name);
      end;
    until FindNext(SR) <> 0;
  finally
    FindClose(SR);
  end;
end;
procedure TForm2.Button2Click(Sender: TObject);
var
  sList: TStringList;
  s: string;
begin
    Results.ClearSelection;
        sList := TStringlist.Create;
        try
           sList.LoadFromFile(FileList); //
           s := sList.Text; //
           if pos(edit1.text, s) > 0 then //Und hier spielt er garnicht mehr mit...
        results.lines.add (FileList);
        finally
          SList.free;
        end;

      end;
  Mit Zitat antworten Zitat