Solved

how to get text from a listview control

Posted on 1998-01-21
3
716 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…

717 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