private bool AddSelectedItemsFromSelection(IntPtr listview) { uint count = InteropUtil.SendMessage(listview, InteropUtil.LVM_GETSELECTEDCOUNT, 0, 0); //if there is at least one item selected we always return these ones if (count > 0) { int ind = -1; for (int i = 0; i < count; i++) { ind = InteropUtil.SendMessageInt(listview, InteropUtil.LVM_GETNEXTITEM, ind, InteropUtil.LVNI_SELECTED); //with the index we can get the item's text string item = GetFileNameFromSelectedItem(listview, ind); _selected.Add(item); } return(true); } return(false); }