LB_SETITEMDATA

3.0

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.

Parameters

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.

Return Value

The return value is LB_ERR if an error occurs.

Example

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));

See Also

LB_ADDSTRING, LB_GETITEMDATA, LB_INSERTSTRING