Get selected item in ListView win32 API

前端 未结 1 1850
失恋的感觉
失恋的感觉 2021-01-05 10:37

I try to create list view item like explorer . I want to get the selected item when I double click on it .

So I can use it to get the path and find file to display .

相关标签:
1条回答
  • 2021-01-05 11:26

    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);
    }
    
    0 讨论(0)
提交回复
热议问题