CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2001
    Posts
    35

    Load images from an external res file or dll?

    Is it possible to load images from an external res file or a dll in VB?


  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Load images from an external res file or dll?

    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
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

  3. #3
    Join Date
    Feb 2001
    Posts
    35

    Re: Load images from an external res file or dll?

    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.


  4. #4
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Load images from an external res file or dll?

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured