Solved

how to get text from a listview control

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DB Mail Export to Excel some row wrap to new row 30 134
Slow process to read Excel 15 149
Build VS2015 project in bat command 3 101
Need more details 5 185
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…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 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