Posted on 1999-06-28
Hi, i have a problem with sorting a CListCtrl control which has 3 columns. I have written a callback function that I call with the SortItems function of the CListCtrl, but it doesn't work properly. Here's the call and the sort function :
// I initialize and add some data in the CListCtrl
int CALLBACK CompareItems(LPARAM lparam1, LPARAM lparam2, LPARAM lparamsort)
CListCtrl* pList = (CListCtrl*) lparamsort;
CString strItem1 = pList->GetItemText(lparam1,0);
CString strItem2 = pList->GetItemText(lparam2,0);
Where m_list_codes is the CListCtrl I created with the ressource editor. When I debug, what is wrong is that the function is called with lparam1 and lparam2 that have values like 22932876 or something like that when in fact, they should have the index of a data in the CListCtrl. Is there some conversion I forgot ? Or is it my sort function that is not correct ? Thanks for your help.