Is it possible to load images from an external res file or a dll in VB?
Printable View
Is it possible to load images from an external res file or a dll in VB?
i haven't done it with a dll, but i have with a .res file.
here's an example:
'theres a resource file setup already with icons and such
Const ICON_CHECK as Integer = 23
ImageList1.ListImages.Add , , LoadResPicture(ICON_CHECK, vbResIcon)
that's it.
hope this helps,
john
John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org
Is there a way to load these images without compiling the res file. I want to load images but don't want to make the compiled program to be too large.
A earlier post of yours suggested the use of Dlls or .Res files. If you can get the images into a .DLL file, then you can use the ExtractAssociatedIcon API to retrieve them
' The Declare
Declare Function ExtractAssociatedIcon Lib "Shell32.DLL" Alias "ExtractAssociatedIconA" (byval hInst as Long, byval lpIconPath as string, lpiIcon as Long) as Long
' A sample
DisplayChangeIconDialog = ExtractAssociatedIcon(App.hInstance, fn, IconIndex) ' Extract the icon
John G