ShellBrowser Delphi Components Documentation
ContentsIndexHome
PreviousUpNext
ShellBrowser.TShellBrowser.HasSubFolders

Use the property HasSubFolders to check if the current object has subfolders.

Syntax
Pascal
function HasSubFolders: Boolean;

The function returns true, if the currently active object has subfolders, false otherwise.

The information comes directly from the windows shell, but it will not always be correct. If you for example put an empty disk into drive A:, windows will report true for HasSubFolders for A:, because it did not yet scan drive A: and so doesn't know if A: has subfolders. If you try this in the Windows Explorer and click on the +-icon on the left of drive A:, you will see it disappear.

These lines show how to fill a branch of a treeview, so that it looks like the tree in the explorer.

While ShellBrowser.Next do begin
  if not ShellBrowser.IsFolder then continue;
  NewNode := TreeView.Items.AddChild(CurrentNode, ShellBrowser.GetShellObjectName);
  NewNode.ImageIndex := ShellBrowser.IconNumber;
  NewNode.SelectedIndex := ShellBrowser.SelectedIconNumber;
  NewNode.HasChildren := ShellBrowser.HasSubFolders;
end;