Hi ALL,

I'm writing a code inserting an item in a listview control,

Code:
TCHAR tstr[255];
_tcscpy(tstr,_T("something"));
                
CListCtrl& m_itemsCtl = m_listview.GetListCtrl ();
LV_ITEM lv_item;
lv_item.mask = LVIF_TEXT|LVIF_PARAM;
lv_item.iSubItem = 0;
lv_item.iItem = 0;
lv_item.state = ~LVIS_SELECTED|~LVIS_FOCUSED;
lv_item.stateMask = LVIS_SELECTED|LVIS_FOCUSED;
lv_item.pszText = tstr; 
int iItem = m_itemsCtl.InsertItem(&lv_item);
The code above inserts a listitem at position 0 (lv_item.iItem = 0), but when i execute this code the InsertItem returns different values and doesn't insert the listiem in the first position.
How to resolve this problem?
I need help.
Thanks in advance.