ShellAPI 取得可执行文件的图标

//取得可执行文件的图标 
  public
Procedure NextIcon;
    { Public declarations } 


{在implementation下面引用};

 uses ShellAPI;

procedure TForm1.NextIcon;
var
  Count : Integer;
  FileName : String;
  i:integer;
begin
  if( FileName <> Edit1.Text ) then
  begin
    FileName:=Edit1.Text;
    I := 0;
    //取得指定程序的图标
    Count := ExtractIcon( Application.Handle, PChar(FileName),
    $FFFFFFFF );
  end
  else
    Inc(I);

  if( I < Count ) then
    Image1.Picture.Icon.Handle :=
    ExtractIcon( Application.Handle, PChar(FileName), I )
  else
    ShowMessage('No more images' );
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
    NextIcon;
end;




原文地址:https://www.cnblogs.com/xe2011/p/2532904.html