Ich hoffe *bet* das ichs jetzt gerafft habe:
Delphi-Quellcode:
procedure TfrmMain.StartIcons();
begin
TThread.CreateAnonymousThread(procedure ()
var
LIcon: TIcon;
dummy: Word;
begin
dummy := 0;
LIcon := TIcon.Create;
LIcon.Transparent := True;
try
TThread.Synchronize (TThread.CurrentThread, procedure ()
var
I: Integer;
begin
lvFiles.Update;
FileIcons.BeginUpdate;
for i := 0 to lvFiles.Items.Count -1 do
begin
LIcon.Handle := ExtractAssociatedIcon( hInstance, PWideChar( lvFiles.Items.Item[ i ].Caption ), dummy );
LIcon.Transparent := True;
lvFiles.Items.Item[ i ].ImageIndex := FileIcons.AddIcon( LIcon );
DestroyIcon( LIcon.Handle );
end;
end);
finally
FileIcons.EndUpdate;
LIcon.Free;
end;
end).Start;
end;