# VBForums CodeBank > CodeBank - Other >  [DELPHI] - Extract Icon

## Madboy

```
uses
  shellApi;

procedure TForm1.Button1Click(Sender: TObject);
const
  ExtrFileName = {Enter FileName.dll here};
var
  icon: TIcon;
  NumberOfIcons, i: Integer;
begin
  icon := TIcon.Create;
  try
    // Get the number of Icons
    NumberOfIcons := ExtractIcon(Handle, PChar(ExtrFileName), UINT(-1));
    ShowMessage(Format('%d Icons', [NumberOfIcons]));
    // Extract the first 5 icons of DLL
    for i := 1 to 5 do
    begin
      // Extract an icon
      icon.Handle := ExtractIcon(Handle, PChar(ExtrFileName), i);
      // Draw the icon on your form
      DrawIcon(Form1.Canvas.Handle, 10, i * 40, icon.Handle);
    end;
  finally
    icon.Free;
  end;
end;
```

----------


## Madboy

Simplified Method:



```
Uses, ShellAPI

procedure ExtractIcon; 
begin 
  image1.picture.Icon.Handle:=extracticon(application.Handle,'C:\Windows\System\Shell32.dll',10); 
end; 

Change the 10 (index of file) to another integer. For example, setting it to:

image1.picture.Icon.Handle:=extracticon(application.Handle,'C:\Windows\System\Shell32.dll',5); 
end; 

will retrieve the 5th icon from the dll
```

----------

