Results 1 to 8 of 8

Thread: How do I associate system image list to ListView control in VB6

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2005
    Posts
    168

    Question How do I associate system image list to ListView control in VB6

    Hi,

    Can anyone tell me how do I associate system image list to a listview control so that I'm able to get correct icons for files and folders.

    Regards,
    Piyush

  2. #2
    Addicted Member
    Join Date
    Mar 2002
    Location
    St. Louis MO
    Posts
    129

    Re: How do I associate system image list to ListView control in VB6

    I'm not sure you should.
    I asked a simular question sometime back about using Windows icons in my app. The replies that I got back suggested that they are copywrited.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2005
    Posts
    168

    Talking Re: How do I associate system image list to ListView control in VB6

    No they are not. Using a few functions of shell32.dll and vb accelerator's system image list you can do this. I've done this in tree view but unable to set icons in listview as it only understand vb's image list for icons and when I try to associate that image list with system's image list everything crashes.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How do I associate system image list to ListView control in VB6

    They are copyrighted, but you're not copying them, you'r merely using them. I've done it myself, using the vbAccelerator code. You need to include the class module cVBALSysImageList.cls in your project. Then to use the images, do this:
    VB Code:
    1. ' Declarations in the form code
    2. Private mobjCSysIML As cVBALSysImageList
    3.  
    4. ' In Form_Load
    5. Set mobjCSysIML as New cVBALSysImageList
    6.  
    7. ' To add a node to a treeview
    8. tvwBrowser.Nodes.Add([Relative], [Relationship, [Key], [Name], mobjCSysIML.ItemIndex([Path of file whos icon you want to show]))

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2005
    Posts
    168

    Angry Re: How do I associate system image list to ListView control in VB6

    I think you didn't read the very first thing I asked so let me repeat it once again:

    I want to associate system imgae list to a LISTVIEW control and not TREEVIEW as I've already done it.

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How do I associate system image list to ListView control in VB6

    Do you mean like this? I can't post the code legally, so here is a link:

    http://vbnet.mvps.org/index.html?cod...eckboxmeth.htm

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How do I associate system image list to ListView control in VB6

    Do you mean like this? I can't post the code legally, so here is a link:

    http://vbnet.mvps.org/index.html?cod...eckboxmeth.htm

    You can use it for yourself, but you can't post in on the web.

  8. #8
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286

    Re: How do I associate system image list to ListView control in VB6

    Recall, the ExtractIcon API is used to retrieve an icon from its module. Find out which module these icons are stored in (Shell32.dll, I believe) and call this function, specifying the correct icon index to retrieve the icon.

    Of course, you will need to know the correct indicies of the icons you wish to extract. This can be done via an icon viewer (Or just write your own program).

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