0

I have a list view control which at the moment only allows one item to be selected. I then read this via the following code:

void CApp::OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult) { int nSelected = (m_List.GetSelectionMark()); ...

However, now I want to make this list able to multiselect, GetSelectionMark() always returns one index. Can anyone help me recode this to return a list of selected indexes?

1 Answer 1

4

Use GetFirstSelectedItemPosition() to find first selected item, then GetNextSelectedItem() for the rest and you're done. :)

2
  • Just saw those on the MSDN, if anyone is interested, I will post the full bit of code.
    – Konrad
    Oct 7, 2008 at 13:59
  • is there any way to find the really first selected position in the order it was slected..? like click and drag from 'fifth to first item' in the list, how can I get 5 as the first selected item. (as it was selected first) Nov 21, 2013 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.