Link to home
Start Free TrialLog in
Avatar of mwebster
mwebster

asked on

how to get text from a listview control

i would like to process this through the WM_COMMAND like i can with a combobox and listbox if this can be done can i have some example code in "C"
thanx in advance
Avatar of inter
inter
Flag of Türkiye image

The following is the section from win32 sdk

LVM_GETITEMTEXT
wParam = (WPARAM) (int) iItem;
lParam = (LPARAM) (LV_ITEM FAR *) pitem;
 
// Corresponding macro
void WINAPI ListView_GetItemText(HWND hwnd, int iItem,
     int iSubItem, LPSTR pszText, int cchTextMax);
 

The LVM_GETITEMTEXT message retrieves the text of a list view item or subitem.

Parameters

The message has the following parameters:

hwnd

Handle to the list view control.

iItem

Index of the list view item.

pitem

Pointer to an LV_ITEM structure. The iSubItem member specifies the index of a subitem, or it can be zero to get the item label. The pszText member points to a buffer that receives the text, and the cchTextMax member specifies the size of the buffer.

The macro has the following parameters:

hwnd

Handle to the list view control.

iItem

Index of the list view item.

iSubItem

Index of the subitem, or zero to retrieve the item label.

pszText

Pointer to the buffer that receives the item or subitem text.

cchTextMax

Size of the buffer, in bytes.

Return Value

If you send this message explicitly, it returns the length of the retrieved string.
If you can send this message implicitly by using the ListView_GetItemText macro, there is no return value.

If I misinterpret your question please let me know!
Igor
ASKER CERTIFIED SOLUTION
Avatar of _Zaphod
_Zaphod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mwebster
mwebster

ASKER

i need to process the text via the WM_COMMAND e.g when the user selects an item from the listview control if this can be done or by some other means using "C", this control is in a dialogbox.