Solved

how to get text from a listview control

Posted on 1998-01-21
3
680 Views
Last Modified: 2013-12-03
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
0
Comment
Question by:mwebster
3 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1410237
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
0
 
LVL 1

Accepted Solution

by:
_Zaphod earned 200 total points
ID: 1410238
HWND list; // the list-view window handle returned from CreateWindowEx
int r, c; // the row and column of the item respectively
char buf[256]; // the buffer to hold the text

ListView_GetItemText(list, r, c, buf, sizeof buf);

To be fair, inter should be granted the points. If you want to be fair, then reject this answer and let inter have the points somehow.
0
 

Author Comment

by:mwebster
ID: 1410239
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.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now