1 Attachment(s)
[RESOLVED] Extract PNG and ICO from resource DLL
I want to display PNG or ICO extracted from a resouce dll file...but i don't know how
...HOW CAN I DISPLAY 48x48,64x64 ICON WITH TRUE COLOR ... AND PNG...??
I build a resource.dll and sample here:
http://www.mediafire.com/?c5gm08b11unr0t7 (Or in attachement)
...containing 32x32,48x48,64x64 icon( 256 and True Color) and PNG file.
Re: Extract PNG and ICO from resource DLL
I'll take a look a bit later and reply if not already replied to by others
But in the mean time, remove the .DLL file from your zip. Forum rules prevent posting compiled binaries.
Re: Extract PNG and ICO from resource DLL
Quote:
Originally Posted by
LaVolpe
I'll take a look a bit later and reply if not already replied to by others
But in the mean time, remove the .DLL file from your zip. Forum rules prevent posting compiled binaries.
Thank you LaVolpe ..
I remove resource.dll from atachement.
You still download full code with dll included from:
http://www.mediafire.com/?c5gm08b11unr0t7
Re: Extract PNG and ICO from resource DLL
I think I get what you are after now.
The simplest method is to use ExtractIconEx API to retrieve a handle and use DrawIconEx to draw it. But it won't work for PNG on XP and lower. And on Win2K and lower, 32bpp icons will look bad.
Otherwise, getting images from an external DLL, EXE, OCX requires some code & many examples exist on the net. Here is one from theVBZone. Scroll towards very bottom.
The problem you will have is that you won't know which are 48x48 and which are PNG without parsing the data. Though one can use the CreateIconFromResourceEx API (I've provided sample usage on this link) and DrawIconEx API to draw it to a window, it won't work if the icon is a PNG unless you are running Vista or better; otherwise it will work for PNGs.
Another option is to look at my "Icon Organizer/Extractor" project linked in my signature below. Specifically within that project look at the ProcessExeDLL function in frmIcon. It shows how I displayed the icons on the form. Initially, you'll want to run the project, press Ctrl+E, then select your DLL. It should display the icons correctly.
1 Attachment(s)
Re: Extract PNG and ICO from resource DLL
Since it is a valid Windows resources file (shown below are the ICO/PNG images extracted therefrom), just call LoadLibraryEx and EnumResourceTypes etc.
Remarks: Some IDE entries for PNG items appear to be erroneous, though this would not affect the correct display of PNG images.
Re: Extract PNG and ICO from resource DLL
THANK YOU LaVolpe
THANK YOU petersen
LaVolpe
Your Icon Organizer/Extractor is exactly what i want ( I need to display PNG file extracted from external resource dll on a form in WinXP,Vista,Win7)...But your code is complex for me...I need a small sample code to do this (extract PNG or ICO and display)
Re: Extract PNG and ICO from resource DLL
All I can do is suggest you spend a little time with that one function I mentioned. Try to understand it. There is stuff in there you won't need to worry about. Specifically, I a temp file to store extracted image data which won't apply in your situation. But the finding and extraction from the resource you'll want and also parsing of the data to determine the size and whether or not a PNG or icon format.
Re: Extract PNG and ICO from resource DLL
Thank you for all explication