LVM_GETITEM message
Applies to: desktop apps only
Retrieves some or all of a list-view item's attributes. You can send this message explicitly or by using the ListView_GetItem macro.
Parameters
- wParam
- Must be zero.
- lParam
-
Pointer to an LVITEM structure that specifies the information to retrieve and receives information about the list-view item.
Return value
Returns TRUE if successful, or FALSE otherwise.
Remarks
When the LVM_GETITEM message is sent, the iItem and iSubItem members identify the item or subitem to retrieve information about and the mask member specifies which attributes to retrieve. For a list of possible values, see the description of the LVITEM structure.
If the LVIF_TEXT flag is set in the mask member of the LVITEM structure, the pszText member must point to a valid buffer and the cchTextMax member must be set to the number of characters in that buffer. Applications should not assume that the text will necessarily be placed in the specified buffer. The control may instead change the pszText member of the structure to point to the new text, rather than place it in the buffer.
If the mask member specifies the LVIF_STATE value, the stateMask member must specify the item state bits to retrieve. On output, the state member contains the values of the specified state bits.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Unicode and ANSI names | LVM_GETITEMW (Unicode) and LVM_GETITEMA (ANSI) |
Send comments about this topic to Microsoft
Build date: 3/6/2012
Applications should not assume that the text will necessarily be placed in the specified buffer. The control may instead change the pszText member of the structure to point to the new text, rather than place it in the buffer.I'm somewhat mystified by this. I understand what they're saying; but how is the poor programmer supposed to know whether they're getting text returned into their buffer, or a pointer set? I guess I could look at the pointer, see if it's NULL, and if so, look at the text buffer to see if anything got copied there (meaning I'd first have to clear it, or at least write a NULL to the first character). This seems rather arbitrary ("Oh, it's 3:00 on Wednesday, so I think I'll use a pointer instead of copying text"). Is there some better way to determine where the text I"m looking for is?
- 4/19/2012
- No C for me