?
Solved

how to get text from a listview control

Posted on 1998-01-21
3
Medium Priority
?
721 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

770 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