List Sort (Win32 / C ++)

I am trying to sort the list when the user clicks on the column heading.

I get a notification LVN_COLUMNCLICK as follows:

  case LVN_COLUMNCLICK:
  {
     NMLISTVIEW*    pListView   = (NMLISTVIEW*)lParam;
     BOOL test = ListView_SortItems ( m_hDuplicateObjectsList, ListViewCompareProc, pListView->iSubItem );
     break;
  }

However, it seems he is failing. My test variable is FALSE, and my ListViewCompareProc never hits (it has a simple return of 1 when I try to hit a debug point in it).

Is there something I am missing to sort the list?

+3
source share
1 answer

Do you use a style LVS_OWNERDATAfor your control?

There are several features incompatible with this style, including sorting:

http://msdn.microsoft.com/en-us/library/bb774735%28VS.85%29.aspx

+5

Source: https://habr.com/ru/post/1724310/


All Articles