Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Chriso on November 11, 2007, 06:22 PM

Title: [VB6] Changing ListView's SmallIcons at Run-Time
Post by: Chriso on November 11, 2007, 06:22 PM
I am trying to change a ListView's SmallIcon set at run-time when the ListView is populated.  The existing items in the ListView do not update using the new ImageList, however new items do.  Anyone know a way around this?

I am currently doing this with no success:

Set lvUsers.SmallIcons = imlClassic
lvUsers.Refresh
Title: Re: [VB6] Changing ListView's SmallIcons at Run-Time
Post by: Barabajagal on November 11, 2007, 06:42 PM
Perhaps try doing lvUsers.ListItems(I).SmallIcon = lvUsers.ListItems(I).SmallIcon or something to that effect?
Title: Re: [VB6] Changing ListView's SmallIcons at Run-Time
Post by: Chriso on November 11, 2007, 06:49 PM
Doesn't work :(
Title: Re: [VB6] Changing ListView's SmallIcons at Run-Time
Post by: brew on November 11, 2007, 09:18 PM
Are you trying to change the imagelist?
I suggest doing it by:
SendMessage(lvUsers.hWnd, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)imlClassic.hWnd);
Title: Re: [VB6] Changing ListView's SmallIcons at Run-Time
Post by: Chriso on November 11, 2007, 10:13 PM
Thanks I'll have a go at that :)
Title: Re: [VB6] Changing ListView's SmallIcons at Run-Time
Post by: Chriso on November 11, 2007, 10:34 PM
No good  :(

Edit: Oops forgot to use ByVal in the listviews hWnd, it works now :)
    SendMessage lv.hwnd, LVM_SETIMAGELIST, LVSIL_SMALL, ByVal imlClassic.hImageList
Title: Re: [VB6] Changing ListView's SmallIcons at Run-Time
Post by: brew on November 11, 2007, 11:19 PM
Sorry for my VB-C fusion code, but at least it got the idea across. I'm glad it's working.