如何取得外部程序ListView中的数据?

kuyi365 2009-09-28 08:04:03

如题,

使用API取得外部应用程序 ListView 控件一列数据.

已知ListView控件的句柄, 怎么某一列获取数据? 请指教


...全文
485 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Tiger_Zhao 2009-09-29
  • 打赏
  • 举报
回复
[Quote=MSDN:]
LVM_GETITEMTEXT
wParam = (WPARAM) (int) iItem;
lParam = (LPARAM) (LPLVITEM) pitem;

iItem
Index of the list view item.
pitem
Address of an LVITEM 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. [/Quote]
设置好的 iSubItem 就可以得到对应列的文本。
magic7004 2009-09-29
  • 打赏
  • 举报
回复
向ListBox发送LB_GETITEMDATA消息
LB_GETITEMDATA
An application sends an LB_GETITEMDATA message to retrieve the application-defined 32-bit value associated with the specified list box item.

LB_GETITEMDATA
wParam = (WPARAM) index; // item index
lParam = 0; // not used; must be zero


king06 2009-09-29
  • 打赏
  • 举报
回复
大致找了一下ListView的API.
Public Sub ListView_GetItemText(hwndLV As Long, i As Long, iSubItem As Long, pszText As Long, cchTextMax As Long)
Dim lvi As LVITEM
lvi.iSubItem = iSubItem
lvi.cchTextMax = cchTextMax
lvi.pszText = pszText
SendMessage hwndLV, LVM_GETITEMTEXT, ByVal i, lvi
pszText = lvi.pszText
End Sub

我也没用过,关注~
kuyi365 2009-09-28
  • 打赏
  • 举报
回复

还是不行, 我可以获取Text label 控件的内容


可以是这个 ListView 控件比较特殊, 它有多列数据

比如,有3列数据ListView 我想获取其中第一列的数据 使用以前的方法不能成功.

请指点下, 最好能说具体点,或给个例程. 谢谢. 我分不多, 能解决我再追加20分
threenewbee 2009-09-28
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 syssz 的回复:]
试一试用SendMessage 向ListView发送消息.消息常数可从网上查到.
[/Quote]
正确。
http://vegeta.blog.enorth.com.cn/article/871.shtml
SYSSZ 2009-09-28
  • 打赏
  • 举报
回复
试一试用SendMessage 向ListView发送消息.消息常数可从网上查到.

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧