Have you tried using SHGetFileInfo? I don't remember why, but I have in memory that it worked better somehow. Perhaps it was because of the color depth, but I'm not sure anymore.
Regards, Madshi.
Main Topics
Browse All Topicshi
I have an exe wich have a 256 colors icon.
I try to save the icon as it is, but I only obtain a 16 colors icon, Why ??
here my code:
var ico :TIcon;
hico :HICON;
begin
hico := ExtractIcon(Hinstance,PCha
ico := TIcon.Create; ico.Handle := Hico;
ico.SaveToFile('test.ico')
ico.Free;
end;
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
no way
same thing with this code
var
Info: TSHFileInfo;
Flags: Cardinal;
begin
Flags := SHGFI_ICON or SHGFI_LARGEICON or SHGFI_USEFILEATTRIBUTES;
SHGetFileInfo(PChar(edit2.
image2.Picture.Icon.Handle
image2.Picture.Icon.SaveTo
end;
Okay, I'm not sure exactly why that doesn't work. Anyway, what I'm personally using (and which works well for me) is calling SHGetFileInfo, but with different parameters. Don't use the "Info.hIcon" member, instead get the handle of the system image list and use the "Info.iIcon" member. This way I'm getting the very same icons that are shown in My Computer. Here's some code for that:
http://www.experts-exchang
Regards, Madshi.
hello DelphiCool, I worked on this saving icon file and icon color depth problem, it ain't so easy, if it was easy, the Delphi TIcon would save an Icon to 256 colors or 24 bit color or 32 bit (XP Icon with alpha chanel shadow info). I could not find a good way to determine the original color depth of an hIcon. Here is a EE question that does a 256 color Icon file save with multiple Icons, but it uses the "Standard" pallete for the Icon -
http://www.experts-exchang
be warned that the PickIconDlg will need PWChar instead of PChar in the NT systems (win2000, win XP), ,
A Icon file save with 24 bit color may suit you better, I have some code for that. Ask questions if you need more information
Business Accounts
Answer for Membership
by: AlexWerPosted on 2003-01-11 at 02:10:19ID: 7707145
Read help :-)
Note: TIcon can be used to display the value of a multi-resolution (>16 color) icon. However, it can not support the creation of multi-resolution icons, nor the resizing of the image after it is loaded from a file or stream.
try to use WIndows Api functions to manipulate multi-resolution icons.