procedure TForm1.Button1Click(Sender: TObject);
var
Icon: TIcon;
OpenDialog : TOpenDialog;
begin
OpenDialog := TOpenDialog.Create(Self);
Icon := TIcon.Create;
if OpenDialog.Execute then
try
Icon.Handle := ExtractIcon(Handle, PChar(OpenDialog.FileName), 0);
Icon.SaveToFile(ExtractFilePath(Application.ExeName) + 'IconFile' + '.ico');
finally
Icon.Free;
OpenDialog.Free;
end;
end;