[英]Get selected item in ListView win32 API
我嘗試創建像資源管理器一樣的列表視圖項。 當我雙擊它時,我想獲得所選項目。
所以我可以使用它來獲取路徑並找到要顯示的文件。 我可以通過senddlgmessage在treeview中完成它。 但看起來它在listview上不起作用。
如果您只是在C ++中使用原始ListView控件,則需要執行以下操作:
// 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);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.