Extract the associated icon of a given file
Add
'ShellApi' in the uses of your form . Put a T../Image (../Image1) and a TButton
(Button1) in your form and put this code in the OnClick of Button1:
Procedure TForm1.Button1Click ( Sender : TObject ) ;
Var
Ico : TIcon ;
Index : word ;
Begin
Ico :=
TIcon.Create ;
Index := 0 ;
Ico.handle
:= ExtractAssociatedIcon ( hInstance , Pchar ( 'c:\Ico\application.zip' ) ,
Index ) ;
../Image1.Picture.Bitmap.Width := Ico.Width ;
../Image1.Picture.Bitmap.Height := Ico.Height ;
../Image1.Picture.Bitmap.Canvas.Draw ( 0 , 0 , Ico ) ;
Ico.Free ;
End ;