This documentation is archived and is not being maintained.


Retrieves the application-supplied doubleword value associated with the specified list-box item.

DWORD_PTR GetItemData(
   int nIndex 
) const;



Specifies the zero-based index of the item in the list box.

The 32-bit value associated with the item, or LB_ERR if an error occurs.

The doubleword value was the dwItemData parameter of a SetItemData call.

// The pointer to my list box.
extern CListBox* pmyListBox;

// If any item's data is equal to zero then reset it to -1.
for (int i=0;i < pmyListBox->GetCount();i++)
   if (pmyListBox->GetItemData(i) == 0)
      pmyListBox->SetItemData(i, (DWORD) -1);