Extract Icon from external file
I've been trying to extract the icon from an external file and save it to a .ico for a while and I've got it to extract the icon and use it as Application.Icon - this works and everything looks just fine. But when I try to save the icon to a file it's saved to a crappy format with nearly no colors.. is there a way to fix this, or is it a limitation in delphi due to some problems similair to PNG/GIF etc?
this is the code I've been trying..
this is the code I've been trying..
- Code: Select all
Var
Icon : TIcon;
IconHandle : HIcon;
Begin
Icon := TIcon.Create;
Try
iconHandle := ExtractIcon(Application.Handle, 'C:\WINDOWS\notepad.exe', 0) ;
Icon.Handle := iconHandle;
Icon.SaveToFile('D:\notepad.ico');
Application.Icon := Icon;
Finally
Icon.Free;
End;
End;