Directory structure with associated icons and file info in ListView

Using ShellAPI unit and few lines of code, we can load directory structure into ListView and show associated icons and information for each file.
First of all, add ShellAPI unit to uses list. Place ListView and ImageList on form. Into ImageList component, we will store icons for each file.

 


In sPath constant is a path to directory we will load into ListView. Of course, you can change this dynamically, this is just for example. ListView will be set to Report style automatically and all files in specified directory will be loaded into it together with icon and description.