1 2 //this code gets list all the files in the windows directory and display it on a 3 memo 4 //field. 5 6 void __fastcall TForm1::Button1Click(TObject *Sender) 7 { 8 TSearchRec SR; 9 10 if (FindFirst("C:\\windows\*.*", faAnyFile, SR) == 0) 11 12 { 13 do 14 { 15 if ((SR.Attr) != faDirectory) 16 { 17 Memo1->Lines->Add(SR.Name); 18 } 19 } while (FindNext(SR) ==0); 20 FindClose(SR); 21 } 22 23 }