Показать сообщение отдельно
  #28  
Старый 09.12.2012, 13:15
Аватар для sariman
sariman sariman вне форума
Активный
 
Регистрация: 19.11.2011
Адрес: Украина, Луганская обл.
Сообщения: 244
Версия Delphi: 7, XE, Lazarus
Репутация: выкл
По умолчанию

Код:
procedure GetAllFiles(Path: string; ListBox: TListBox );
var
  sRec: TSearchRec;
  isFound: Boolean;
begin
  Path := IncludeTrailingPathDelimiter(Path);
  isFound := FindFirst(Path + '\*.*', faAnyFile, sRec) = 0;
  while isFound do
  begin
    if (sRec.Name <> '.') and (sRec.Name <> '..') then
    begin
      if (sRec.Attr and faDirectory) = faDirectory then
        GetAllFiles(Path + sRec.Name, ListBox);
      if Pos('.mp3', Copy(sRec.Name, Length(sRec.Name)-3, 4)) = 1 then
        ListBox.Items.Add(Path + sRec.Name);
      if Pos('.AAC', Copy(sRec.Name, Length(sRec.Name)-3, 4)) = 1 then
        ListBox.Items.Add(Path + sRec.Name);
    end;
    Application.ProcessMessages;
    isFound := FindNext(sRec) = 0;
  end;
  FindClose(sRec);
end;
Ответить с цитированием