Link to home
Start Free TrialLog in
Avatar of aquila98
aquila98

asked on

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

Hello,

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
Avatar of Erick37
Erick37
Flag of United States of America image

See this sample:

"Viewing and Retrieving Embedded Icons with ExtractIcon"
http://vbnet.mvps.org/code/icon/extracticon.htm
Avatar of aquila98
aquila98

ASKER

Thanks...
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)

thanks.
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial