LB_SETITEMDATA
wParam = (WPARAM) index; /* item index */
lParam = (LPARAM) dwData; /* value to associate with item */
An application sends the LB_SETITEMDATA message to set a doubleword value associated with the specified item in a list box.
index
Value of wParam. Specifies the zero-based index of the item.
dwData
Value of lParam. Specifies the value to be associated with the item.
The return value is LB_ERR if an error occurs.
This example associates a handle of a 64-byte memory object with each item in a list box:
HGLOBAL hLBData;
LPSTR lpLBData;
HWND hListBox;
WPARAM nIndex;
case WM_INITDIALOG:
if ((hLBData = GlobalAlloc(GMEM_MOVEABLE, 64))) {
if ((lpLBData = GlobalLock(hLBData))) {
.
. /* Store the data in the memory object. */
.
GlobalUnlock(hLBData);
}
}
SendMessage(hListBox, LB_SETITEMDATA, nIndex,
MAKELONG(hLBData, 0));