Results 1 to 8 of 8

Thread: [RESOLVED] Extract PNG and ICO from resource DLL

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Resolved [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.
    Attached Files Attached Files
    Last edited by cliv; Feb 16th, 2011 at 09:32 AM.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Re: Extract PNG and ICO from resource DLL

    Quote Originally Posted by LaVolpe View Post
    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

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Last edited by LaVolpe; Feb 16th, 2011 at 11:32 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    Hyperactive Member
    Join Date
    Jul 2010
    Posts
    273

    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.
    Attached Images Attached Images  
    Last edited by petersen; Feb 16th, 2011 at 05:19 PM. Reason: Added remarks.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    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)
    Last edited by cliv; Feb 17th, 2011 at 02:57 AM.

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Re: Extract PNG and ICO from resource DLL

    Thank you for all explication

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width