得到的ListView Win32 API的所选项目 [英] Get selected item in ListView win32 API
本文介绍了得到的ListView Win32 API的所选项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试着像资源管理器创建列表视图项。我想,当我双击它来获得所选择的项目。
I try to create list view item like explorer . I want to get the selected item when I double click on it .
所以我可以用它来获取路径,找到文件来显示。我可以做senddlgmessage它树形。但它看起来像它不能在列表视图工作。
So I can use it to get the path and find file to display . I can do it in treeview by senddlgmessage. But it looks like it doesn't work on listview .
推荐答案
如果你只是使用C ++中的原始ListView控件,你需要做的是这样的:
If you are just using a raw ListView control in C++, you need to do something like this:
// Get the first selected item
int iPos = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
while (iPos != -1) {
// iPos is the index of a selected item
// do whatever you want with it
// Get the next selected item
iPos = ListView_GetNextItem(hListView, iPos, LVNI_SELECTED);
}
这篇关于得到的ListView Win32 API的所选项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文