Ich habe gerade mal versucht hiermit ShellIcons anzeigen zu lassen. Klappt auch aber das zieht die Performance total in den Keller
Delphi-Quellcode:
procedure TfrmDirectoryBrowser.FormCreate(Sender: TObject);
var
SysIL: HIMAGELIST;
Info: TSHFileInfo;
SmallImages: TImageList;
begin
SmallImages := TImageList.Create(Self);
SysIL := SHGetFileInfo('', 0, Info, SizeOf(TSHFileInfo), SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
if SysIL <> 0 then
begin
SmallImages.Handle := SysIL;
SmallImages.ShareImages := True;
vstDirectoryBrowser.Images := SmallImages;
end;
.....
end;
procedure TfrmDirectoryBrowser.vstDirectoryBrowserGetImageIndex(Sender: TBaseVirtualTree; Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex; var Ghosted: Boolean; var ImageIndex: Integer);
var
NodeData: PDirectory;
Info: TSHFileInfo;
begin
NodeData := Sender.GetNodeData(Node);
if NodeData^.iIconIndex = -1 then
begin
SHGetFileInfo(PChar(NodeData^.FullPath), FILE_ATTRIBUTE_NORMAL, Info, SizeOf(TSHFileInfo), SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
NodeData^.iIconIndex := Info.iIcon;
end;
ImageIndex := NodeData^.iIconIndex;
end;