I use this
procedure TFtpForm.FormCreate(Sender: TObject);
ListView1.SmallImages := ImageList2;
ListView1.SmallImages.ShareImages := True;
ListView1.SmallImages.Handle := ShGetFileInfo('*.*', 0, SHFileInfo,
SizeOf(SHFileInfo), SHGFI_SMALLICON or SHGFI_ICON or SHGFI_SYSICONINDEX);
if FileTipe[a]= '1' then
ListView1.SmallImages := ImageList2; ListView1.SmallImages.ShareImages := True;
ShGetFileInfo(PChar'c:\*'+ExtractFileExt(Files[a])), 0, SHFileInfo, SizeOf(SHFileInfo),SHGFI_SMALLICON or SHGFI_SYSICONINDEX or SHGFI_TYPENAME);
this way I Put file names in a ListView with their respective icons depending on the file extension.. ok 2 questions:
how to get the right ICOn for EXE files ? I mean, their own icon.. now I only see the MSDOS-like icon for the exe files..
q2: how can I have 2 imagelists so depending on if FileTipe.. = 1 or 2 then I want to use a imagelist or another..
imagelist1 only has 1 icon which is the folder icon, and imagelist2 is which i use to get the extensions icons.. but if I switch the ListView.smallicons:= imagelist1/2 depending on FileTipe ( see code above ) then it doesn't work.. please try the code before answering to see what I mean.. you have to add SHELLAPI to the uses clause.