You should be using the
GetItem[
^] function.
The function
GetItemData[
^] returns the 32-bit application-specific value associated with the specified item. You have set no such value in the code you shown.
Answer to OP comment:
You need to specify which items information you want to retrieve, this is done in the
LVITEM
structure you pass to the
GetItem
function.
Look at the
LVITEM[
^] documentation.
You can use the following code:
onInsertItem( int iItem, CListCtrl* pListCtrl )
{
LVITEM plvItem;
long lDataItem = 0;
plvItem.mask = LVIF_TEXT;
plvItem.iItem = iItem;
if( pListCtrl != NULL && pListCtrl->GetItem( &plvItem ) )
lDataItem = atol( plvItem.pszText );
}