这是一个提取图标,并放在listview里,listview+imagelist
procedure TForm1.Button4Click(Sender: TObject);
var
count:integer;
i:integer;
myicon:ticon;
myimage:timage;
begin
if op3.execute then
begin
Count:=ExtractIcon(hinstance,PChar(op3.FileName),$FFFFFFFF);
label3.caption:='图标个数:'+inttostr(count);
imagelist1.Clear;
listview1.Clear;
FOR I:=0 TO COUNT-1 do
begin
myicon:=ticon.Create;
myicon.Handle:=extracticon(hinstance,pchar(op3.FileName),i);
imagelist1.AddIcon(myicon); //imagelist这里加
listview1.Items.Add;
listview1.Items.ImageIndex:=i;//listview里加
myicon.Free;
end;
end;
end;