procedure TForm1.Button1Click(Sender: TObject); var Icon: TIcon; FileInfo: SHFILEINFO; begin Icon := TIcon.Create; try // Get the Icon SHGetFileInfo(PChar('Filename.exe'), 0, FileInfo, SizeOf(FileInfo), SHGFI_ICON); icon.Handle := FileInfo.hIcon;
DestroyIcon(FileInfo.hIcon); // Save the Icon to a file: icon.SaveToFile('IconFromExe.ico'); // Set the Icon as Application Icon (temporary) Application.Icon := icon;
finally Icon.Free; end; end;
|