Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Extract icon of file
Use ExtractAssociatedIcon for getting Handle of the icon. And use this result for Draw method of Canvas.
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
Edit1.Text:=OpenDialog1.FileName;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
MyIcon: TIcon;
Filter: Word;
begin
Filter:=0;
MyIcon:=TIcon.Create;
MyIcon.Handle:=ExtractAssociatedIcon(
hInstance,
PChar(Edit1.Text),
Filter);
Image1.Canvas.Draw(0, 0, MyIcon);
end;
- Related components
- TFileSearch
- TFolderMonitor
- TFileVersion
-
More for developers