1 2 //This code will list all the files in the windows directory and display it on a 3 //memo field.4 5 procedure TForm1.Button1Click(Sender: TObject);
6 var7 SR: TSearchRec;
8 begin9 if FindFirst( 'c:\WinNT\*.*', faAnyFile, SR) = 0 then10 begin11 repeat12 if (SR.Attr <> faDirectory) then13 begin14 memo1.lines.Add(SR.Name);
15 end;
16 until FindNext(SR) <> 0;
17 FindClose(SR);
18 end;
19 20 end;