Cautote CListCtrl :: setItemData ()
Case Download
When using the ClistCtrl in the MFC, I encountered a strange phenomenon. When you go to a ListCtrl insert an ITEM, I hope that each Item can bind a pointer to the data. There is a lot of ways to achieve this requirement. I use two of them. The first method: Int InsertItem (uint nmask, int nitem, lpctstr lpszitem, uint nstate,
Uint nStatemask, int nimage, lparam lparam; in this approach, I placed the data pointer to be bound to the LPARAM parameter. Second method: int INSERTITEM (int NITEM, LPCTSTSTR LPSZITEM);
Bool Setitemdata (Int Nitem, DWORD DWDATA); I am inserted into this item and then bind this data pointer. When the number of Items to be inserted is very much, the efficiency of these two methods is very different. Method 1 The efficiency is much higher than the method 2. In the example I came with, I inserted 10,000 items. The result method 1 used 300 ms, while the method 2 used nearly 33,000 ms. Efficiency is actually a hundred times difference! It's very puzzling! Is SETITEMDATA () take up too much time? A friend who knows can tell me. In addition, I didn't test CTREECTRL, I don't know if it is?