TListView,读取行(列)
在vc环境下。
已获得一TListView类的句柄,想把其某行(列)的内容读取出来,应当如何实现啊?若能读出某行列焦点的数据则更好。具体步骤如下:
1) 获得句柄:HWND hwandTListView = FindWindowEx(hwndInboxList, NULL, "TListView", NULL);已成功;
2)获得hwandTListView 的长度,并读取某行(列):网上看了下代码,经过修改如下:
TListView ListView1 =(TListView)hwandTListView;//自己加的;error C2065: 'TListView' : undeclared identifier
int i;
For i:=0 to ListView1.Items.Count-1 Do
If ListView1.Items[i].Selected then //i=ListView1.Selected.index
begin
/读某行某列的操作:
Edit1.Text := listview1.Items[i].Caption; //读第i行第1列
Edit2.Text := listview1.Items[i].SubItems.strings[0]; //读第i行第2列
Edit3.Text := listview1.Items[i].SubItems.strings[1]; //读第i行第3列
//以次类推,可以用循环读出整列。
end;
//将焦点上移一行:
ListViewItemMoveUpDown(ListView1, ListView1.Selected, False, True);//下移
问题如下:
查了下,TListView 是delphi的概念,但对delphi只是了解。在应用TListView 前应该导入一些头文件或类吧,具体应该是哪些啊?
或是可否转换成其他的List类型,然后再应用。现在只有这些思路,请高手指点,最好能写出关键代码,谢谢~
把所有的分都拿出来了啊~~~~,在线等~~~~