First of all, in my searches on the subject I have found a great deal of confusion about ListView and ListCtrl and so on. So allow me to first clarify my situation:
I am using Visual C++ 6.0 (SP5) and an MFC Dialog App.
The ListView and ImageList I am using comes from the MSCOMCTL.OCX that is updated from SP5 and is NOT the one uses LVITEM structures, et al. They look and act very much the same, but is not the same. It uses CListItem and CListItems classes et al (there many more for columnheaders and images, etc)
I have added a Image List (Version 6.0) and a List View (Version 6.0) from MSCOMCTL.OCX. (This means that VC++ adds uneditable classes to use the control and a creates a user named class for the control itself)
Both are controls bound to member variables. All of the controls in MSCOMCTL.OCX and are derived from COleDispatchDriver (IDispatch stuff).
When you look at the property pages, there is a tab for Image List, but none of the image lists added to my dialog appear in the drop down lists.
So, I turned my attention to the functions provided with the created classes: There are 3 functions corresponding to the 3 drop down lists in the Image List property page (Very similar to the CListCtrl, except there are 3 separate function for each image list). These were generated by VC++ when I mapped the control to a member variable.
The image list classes use a CImages and CImage classes.
My attempt to set the Icons ImageList looks like this:
c_imgs = m_imglist1.GetListImages();
m_lstview1.SetIcons( c_imgs.m_lpDispatch ); // LPDISPATCH for c_imgs
It make no difference where I run this code, OnInitDialog() or in a Button Event. When I run the app a message box appears saying "Invalid object". Yes I have added icons to the image list.
Attempt to add the an LPDISPATCH from the image list fail miserably.
How is the Image List supposed to be added? What else do I have to set up in the List or the View to Add an ImageList to it?