| Код | function GetDirs(const ADir: string): TStrings; var lSR: TSearchRec; lDir, lTmp: string; begin Result := TStringList.Create; if DirectoryExists(ADir) then begin lDir := IncludeTrailingPathDelimiter(ADir) + '*.*'; if (FindFirst(lDir, faAnyFile, lSR) = 0) then begin try repeat if (lSR.Name <> '.') and (lSR.Name <> '..') then begin lTmp := ADir + lSR.Name; if DirectoryExists(lTmp) then Result.Add(lTmp); end; until FindNext(lSR) <> 0; finally FindClose(lSR); end; end; end; end;
procedure TForm1.ButtonClick(Sender: TObject); begin ComboBox.Items:=GetDirs('c:\'); end;
|
а лучше использовать кже готовые TShellComboBox,TShellListView,TShellTreeView
|