[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2004-11-29
Medium Priority
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
  • 2
LVL 32

Expert Comment

ID: 12699747
See this sample:

"Viewing and Retrieving Embedded Icons with ExtractIcon"

Author Comment

ID: 12700237
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

Erick37 earned 300 total points
ID: 12700980
See this sample code:

Create a VB Picture from an API Icon Handle

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month19 days, 13 hours left to enroll

873 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