Thema: Delphi Komplette Partition C:

Einzelnen Beitrag anzeigen

Smeivel

Registriert seit: 18. Apr 2006
Ort: Wolfhagen
29 Beiträge
 
#10

Re: Komplette Partition C:

  Alt 4. Jul 2006, 14:29
Doch du musst dass dann ungefähr so verwenden:
Delphi-Quellcode:
unit MyPad1;

interface

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

type
  TForm1 = class(TForm)
 
   
    procedure ....................;
    procedure ....................;
    procedure ....................;

  private

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

  end;

var
  Form1: TForm1;
  Weiter:Boolean;
  a:integer;
implementation

{$R *.dfm}

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
a:=0;
Memo1.Clear;
Form1.GetFiles('C:\');
end;

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.
sogar gestestet!
  Mit Zitat antworten Zitat