提取小图标

procedure TForm1.Button3Click(Sender: TObject);
var
  shfileinfo:tshfileinfo;
  icon:ticon;
begin
  icon := ticon.create;
  try
    if opendialog1.execute then
    begin
      shgetfileinfo(pchar(opendialog1.filename),0,shfileinfo,sizeof(tshfileinfo),
      shellapi.shgfi_icon or shellapi.shgfi_smallicon or shellapi.shgfi_typename);
      icon.handle := shfileinfo.hicon;
      self.image1.picture.assign(icon);
      self.image1.update;
    end;
  finally
    icon.free;
  end;
  image1.Picture.SaveToFile('c:\dddddd.bmp');
end;

本文出自 “601880” 博客,谢绝转载!

你可能感兴趣的:(职场,休闲)