c++clistctrl

Retrieving the selected row in a CListCtrl


I have a CListCtrl in which there are 2 columns and multiple rows. I want to get the the index of the selected row. I am able to get the row when the user clicks on the first column but could not when clicked on the second column.

Any suggestions ?


Solution

  • Call m_ListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT); after the creation of the control - usually in OnInitDialog.