Stromový adresárov v menu
Spôsob ako vytvoriť adresárovú štruktúru do menu.
procedure TForm1.BuildMenuTree(Path: String; Root: TMenuItem); var S: TSearchRec; Rslt: Integer; Item: TMenuItem; begin if Path[Length(Path)] <> '\' then Path := Path + '\'; Rslt := FindFirst(Path + '*.*', faDirectory, S); while Rslt = 0 do begin if ((S.Attr and faDirectory) <> 0) and (S.Name <> '.') and (S.Name <> '..') then begin Item := TMenuItem.Create(Self); Item.Caption := S.Name; Root.Add(Item); BuildMenuTree(Path + S.Name, Item); end; Rslt := FindNext(S); end; SysUtils.FindClose(S); end; //Spustíš to takto: BuildMenuTree('C:\', Item); //Item je item v menu