PDA

Click to See Complete Forum and Search --> : "ImageList_ReplaceIcon" API function problems


dubae524
Jul 7th, 2001, 01:07 AM
Hey everybody. I'm trying to use the "ImageList_ReplaceIcon" API function to add an icon to an ImageList. Although I haven't tested it with non-VB ImageLists, all the sites I referred to blatantly imply that it does work with VB ImageLists. Thus, I have been completely baffled as to what to do.

Public Declare Function ImageList_ReplaceIcon Lib "comctl32.dll" _
(ByVal hImageList As Long, ByVal i As Long, ByVal hIcon As Long) _
As Long

With myhiml being ImageList.hImageList, -1 -- -1 adds it to the end of the list. I have also tried 0 and still came up error -- being the index, and hIcon being the icon to add to it.

retval = ImageList_ReplaceIcon(myhiml, -1, hIcon)

However, it does not add it to the list; and I'm frankly getting a bit annoyed, too, because API calls can sometimes give me problems. Oh, by the way, the function returns -1, implying error.

If anybody can help me, please reply. Your response will be greatly appreciated. :)