LB_GETITEMDATA
wParam = (WPARAM) index; /* item index */
lParam = 0L; /* not used, must be zero */
An application sends the LB_GETITEMDATA message to retrieve the application-supplied doubleword value associated with the specified item in a list box. (This is the value of the lParam parameter of an LB_SETITEMDATA message.)
index
Value of wParam. Specifies the zero-based index of the item.
The return value is the doubleword value associated with the item, or it is LB_ERR if an error occurs.
This example retrieves the value associated with an item in a list box. The value is the handle of a global memory object.
HGLOBAL hLBData;
LPSTR lpLBData;
HWND hListBox;
WPARAM nIndex;
if ((hLBData = LOWORD(SendMessage(hListBox, LB_GETITEMDATA,
nIndex, 0L)))) {
if ((lpLBData = GlobalLock(hLBData))) {
.
. /* Access or manipulate the data */
.
GlobalUnlock(hLBData);
}
}