View Single Post
  #1  
Old 07-10-2023, 03:05
hitman797's Avatar
hitman797 hitman797 is offline
Registered User
 
Join Date: Feb 2013
Location: Algeria
Posts: 168
Thanks: 486
Thanked 202 Times in 122 Posts
hitman797 is on a distinguished road
System.SysUtils and System.IOUtils Unite:
Code:
procedure TForm8.Button1Click(Sender: TObject);
var
  i: Integer;
  hFileName: String;
  hDirArray, hFileArray: TStringDynArray;
begin
  ListBox1.Items.Clear;
  ListBox1.BeginUpdate;
  hFileName := 'C:\Windows';
  ListBox1.Items.Add(ExtractFileName(hFileName));
  hDirArray := TDirectory.GetDirectories(hFileName);
  for hFileName in hDirArray do
  begin
    ListBox1.Items.Add(ExtractFileName(hFileName));
  end;
{  hFileArray := TDirectory.GetFiles(hFileName);
  for hFileName in hFileArray do
  begin
    ListBox1.Items.Add(ExtractFileName(hFileName));
  end;  }
  ListBox1.EndUpdate;
end;
Attached Images
File Type: png Capture.PNG (129.8 KB, 141 views)
Attached Files
File Type: 7z Project8.7z (9.66 MB, 14 views)
Reply With Quote
The Following User Says Thank You to hitman797 For This Useful Post:
audiofeel (07-10-2023)
Sponsored Links