Thema: Delphi Komplette Partition C:

Einzelnen Beitrag anzeigen

Benutzerbild von I.A.
I.A.

Registriert seit: 29. Okt 2005
Ort: Hinter den Bergen bei den Sieben Zwergen
98 Beiträge
 
Delphi 2005 Personal
 
#16

Re: Komplette Partition C:

  Alt 4. Jul 2006, 18:14
So habe ich das von dir kopiert und eingesetzt aber da ist immer noch Puplic und GetFiles rot unterstrichen.

Delphi-Quellcode:
public
     procedure GetFiles(const Path: string);
   { Public-Deklarationen }


procedure TForm1.GetFiles(const Path: string);
var
  SearchRec: TSearchRec;
  p: string;

begin
     Label1.Caption:='';
     p := path + '*.*';
     if FindFirst(p, faAnyFile, SearchRec) = 0 then
     begin
      repeat
        if (SearchRec.Attr and faDirectory) = faDirectory then
        begin
         if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
           GetFiles(Path + SearchRec.Name + '\');
           end
        else begin
        Form1.Memo1.Lines.Add(Path + SearchRec.Name);
        a:=a+1;
        Refresh;
        Application.ProcessMessages;
        ProgressBar1.StepIt;
        end;
      until
        FindNext(SearchRec) <> 0;
      FindClose(SearchRec);
     end;
     ProgressBar1.Position:=0;
     Label1.Caption:=IntToStr(a) +' Dateien gescannt';
Das war deins jetzt gebe ich den Komletten Code so wie er bei mir da steht :
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, FileCtrl, ComCtrls;

type
  TForm1 = class(TForm)
    ProgressBar1: TProgressBar;
    Memo1: TMemo;
    SaveDialog1: TSaveDialog;
    FileListBox1: TFileListBox;
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FileListBox1Change(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  a:integer;

implementation

{$R *.dfm}

procedure TForm1.FileListBox1Change(Sender: TObject);
begin
FileListBox1.ApplyFilePath('C:\');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
savedialog1.Execute;
memo1.Lines.savetofile(savedialog1.filename+ '.mp3');
end;

public
     procedure GetFiles(const Path: string);
   { Public-Deklarationen }


procedure TForm1.GetFiles(const Path: string);
var
  SearchRec: TSearchRec;
  p: string;

begin
     Label1.Caption:='';
     p := path + '*.*';
     if FindFirst(p, faAnyFile, SearchRec) = 0 then
     begin
      repeat
        if (SearchRec.Attr and faDirectory) = faDirectory then
        begin
         if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
           GetFiles(Path + SearchRec.Name + '\');
           end
        else begin
        Form1.Memo1.Lines.Add(Path + SearchRec.Name);
        a:=a+1;
        Refresh;
        Application.ProcessMessages;
        ProgressBar1.StepIt;
        end;
      until
        FindNext(SearchRec) <> 0;
      FindClose(SearchRec);
     end;
     ProgressBar1.Position:=0;
     Label1.Caption:=IntToStr(a) +' Dateien gescannt';
end;

end;

end.
  Mit Zitat antworten Zitat