Click to See Complete Forum and Search --> : Load images from an external res file or dll?


vzcharlie
March 15th, 2001, 12:13 PM
Is it possible to load images from an external res file or a dll in VB?

Johnny101
March 15th, 2001, 04:30 PM
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

vzcharlie
March 15th, 2001, 05:40 PM
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.

John G Duffy
March 15th, 2001, 07:49 PM
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