![]() |
|
|
Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
|
Опции темы | Поиск в этой теме | Опции просмотра |
#12
|
|||
|
|||
![]() [quote=notricky]
Цитата:
Код:
TWinampPlaylist.Destroy; Код:
....If MyPlayerButton.Checked then ... Короче - вот: Код:
Procedure BoxChange (Box: TComboBox; StartDir: string; Level_: integer); var s: string; begin form1.DirectoryListBox1.Directory:= StartDir; repeat s:= form1.DirectoryListBox1.GetItemPath(Level_); if pos(StartDir, s)>0 then Delete(s, Pos(StartDir, s), length(StartDir)); if s <> '' then Box.Items.Add(s); inc (Level_); until s = ''; end; и если подавать ей Level_ := 0, то содержимое ArtistBox'а будет выглядет так: C:\ C:\Program Files C:\Program Files\Borland C:\Program Files\Borland\Delphi7 C:\Program Files\Borland\Delphi7\Projects C:\Program Files\Borland\Delphi7\Projects\Bpl C:\Program Files\Borland\Delphi7\Projects\Music а уж потом можно найти и Диану, и Маленького Принца с вложенными туда альбомами. Так вот чтобы исключить этот "мусор" - надо рассчитать Level_ : Код:
Level:= 0; i:= Level; repeat s:= DirectoryListBox1.GetItemPath(i); memo2.Lines.Add('s= ' + s); inc (i); until Pos ('Music', s) >0; CurDir:= s + '\'; StrLCopy (buf, PChar(s), max_path); for i := 0 to SizeOf(buf)do if buf[i] = '\' then inc (Level); memo2.Lines.Add('Level= ' + inttostr(Level)); memo2.Lines.Add('CurDir= ' + CurDir); BoxChange (ArtistBox, CurDir, Level +1); // ниже папки Music ArtistBox.ItemIndex := 0; artist:= CurDir + ArtistBox.Items[ArtistBox.ItemIndex]+'\'; memo2.Lines.Add('artist= ' + artist); s= k:\ s= k:\Music Level= 4 CurDir= k:\Music\ artist= k:\Music\\ album= \ и всё - пусто ![]() ![]() Заранее благодарен Последний раз редактировалось UFO 007, 07.01.2011 в 15:54. |