Sorting and LVN_ITEMCHANGED

Hi gurus,

I create a class derived from CListCtrl. This class is like ListCtrl in Windows Explorer in Details View. You can create new file, rename, or delete, re-arrange, ...

Now I have a problem. My class do some jobs when LVN_ITEMCHANGED is notified. When I re-order the list, the OnItemChanged is called many times that is equal to the Item Count. This made me annoyed and wasted time. If anyone know how to re-order the list without notifiying LVN_ITEMCHANGED, please let me know. Thanks in advanced.

Ah, yeah, my class uses SortItems(...) function of CListCtrl to sort. Everything seems good except the above problem.
[650 byte] By [quangnt] at [2007-11-18 15:10:05]
# 1 Re: Sorting and LVN_ITEMCHANGED
One solution is a boolean variable to temporarily disable the work done inside the message handler.

Kuphryn
kuphryn at 2007-11-11 2:00:09 >
# 2 Re: Sorting and LVN_ITEMCHANGED
Thanks kuphryn for your quick answer. Before posting, I tried this solution. But LVN_ITEMCHANGED is notified when sorting has been finished. I think that when SortItems is returned, CListCtrl have item list in the sorted order, then CListCtrl remove all current items and add items in the sorted list. Now this time LVN_ITEMCHANGED is notified when each item is added. Is this correct?
quangnt at 2007-11-11 2:01:10 >
# 3 Re: Sorting and LVN_ITEMCHANGED
Correct.

Kuphryn
kuphryn at 2007-11-11 2:02:11 >