LVN_GETDISPINFO notification code

Sent by a list-view control to its parent window. It is a request for the parent window to provide information needed to display or sort a list-view item. This notification code is sent in the form of a WM_NOTIFY message.


LVN_GETDISPINFO
		
    pdi = (NMLVDISPINFO*) lParam

Parameters

lParam

Pointer to an NMLVDISPINFO structure. On input, the LVITEM structure contained in this structure specifies the type of information required and identifies the item or subitem of interest. Use the LVITEM structure to return the requested information to the control. If your message handler sets the LVIF_DI_SETITEM flag in the mask member of the LVITEM structure, the list-view control stores the requested information and will not ask for it again.

Return value

No return value.

Remarks

The notification receiver casts lParam to retrieve the NMLVDISPINFO structure. The wParam parameter contains the notification code.

A list-view control sends the LVN_GETDISPINFO notification code to retrieve item information that is stored by the application rather than the control. The information can be text or icon information for an item. It can also be item state information. See the LVM_SETCALLBACKMASK message for more information on implementing item state on a callback basis.

For more information on list-view callbacks, see Callback Items and the Callback Mask.

Examples

The following example shows how this notification code might be handled to set the text in the columns of a list view. The data for each item is held in the following structure.


 typedef struct tagPETINFO
{
    TCHAR szName[50];
    TCHAR szBreed[50];
    TCHAR szGender[7];
    TCHAR szPrice[20];
    GroupIds iGroup;
} PETINFO;
            

The following is from the WM_NOTIFY handler in the dialog procedure.


    case WM_NOTIFY:
        switch (((LPNMHDR) lParam)->code)
        {
        case LVN_GETDISPINFO:
            {
                NMLVDISPINFO* plvdi = (NMLVDISPINFO*)lParam;    
                switch (plvdi->item.iSubItem)
                {
                case 0:
                    // rgPetInfo is an array of PETINFO structures.
                    plvdi->item.pszText = rgPetInfo[plvdi->item.iItem].szName;
                    break;

                case 1:
                    plvdi->item.pszText = rgPetInfo[plvdi->item.iItem].szBreed;
                    break;

                case 2:
                    plvdi->item.pszText = rgPetInfo[plvdi->item.iItem].szGender;
                    break;

                case 3:
                    plvdi->item.pszText = rgPetInfo[plvdi->item.iItem].szPrice;
                    break;

                default:
                    break;
                }
                return TRUE;
            }
      // More notifications...
      }

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Commctrl.h

Unicode and ANSI names

LVN_GETDISPINFOW (Unicode) and LVN_GETDISPINFOA (ANSI)

See also

LVN_SETDISPINFO

 

 

Community Additions

ADD
Show:
© 2014 Microsoft