Get selected item in win32 ListView API

I am trying to create a list list item like explorer. I want to get the selected item when I double click on it.

Therefore, I can use it to get the path and find the file to display. I can do this in treeview by senddlgmessage. But it does not seem to work on the list.

+6
listview winapi
source share
1 answer

If you just use 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); } 
+15
source share

All Articles