MyIcon := TIcon.Create;
MyFilePath := PathName + PathDelim + FileName;
if GetFileIcon(MyFilePath, MyIcon) = True then
begin
ListItem.ImageIndex := Icons.AddIcon(MyIcon);
ListItem.ImageIndex := ImageList_ReplaceIcon(Icons.ResolutionByIndex[0].Reference.Handle, ListItem.ImageIndex, MyIcon.Handle);
if (MyEXT = '.LNK') or (MyEXT = '.EXE') or (MyEXT = '.ICO') then
VLEIcons.InsertRow(IntToStr(ListItem.Index), IntToStr(ListItem.ImageIndex), True)
else
VLEIcons.InsertRow(MyEXT, IntToStr(ListItem.ImageIndex), True);
end;
MyIcon.Free;