hot to work with .icl files (icon library) in VB ???

Posted on 2004-11-29
Last Modified: 2012-06-21

I need to open a .icl file and extract one ico from it at random (at runtime of course) and I do not wat to extract each and every .ico within the .icl file manually only to use loadpicture() in VB...

Instead I want to be able to work directly with the .icl file, something like
Loadpicture("..../iconlib.icl", iconNumberSuch) or
Loadpicture("..../iconlib.icl", iconName)

I would also like to be able to create a new .icl file...

But I have found NO example of how to do this in VB? nothing on msdn, and other help sites...

Does anyone here have a working sample or source code to share or a pointer to a help site?

Thanks in advance
Question by:aquila98
    LVL 32

    Expert Comment

    See this sample:

    "Viewing and Retrieving Embedded Icons with ExtractIcon"
    LVL 2

    Author Comment

    I saw this sample but:
     hIcon = ExtractIcon(0&, sIconFile, index)
    Call DrawIcon(Picture1.hdc, x, Y, hIcon)
    Call DestroyIcon(hIcon)

    this hIcon cannot be used in a treeview or in a menu or in any place where loadpicture should be used...

    Unless there is a way to convert the hIcon to a IPicDisp? and then load it like it came from a loadpicture call???

    I must set it on a status bas also so my requirement are as follows:
    sbStatusbar.Panels(2).Picture= LoadPictureFramICL("iclfilename.icl", "icon name") or
    sbStatusbar.Panels(2).Picture= LoadPictureFramICL("iclfilename.icl", iIconIndex)

    LVL 32

    Accepted Solution

    See this sample code:

    Create a VB Picture from an API Icon Handle

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now