For finding in code which items are selected:
CListCtrl* pListCtrl = (CListCtrl*) GetDlgItem(IDC_YOURLISTCON
ASSE
POSITION pos = pList->GetFirstSelectedItem
if (pos == NULL)
TRACE0("No items were selected!\n");
else
{
while (pos)
{
int nItem = pList->GetNextSelectedItem(
TRACE1("Item %d was selected!\n", nItem);
// you could do your own processing on nItem here
}
}
Main Topics
Browse All Topics





by: AndyAinscowPosted on 2009-11-05 at 23:26:44ID: 25757281
>>but I don't understand how to select an item from the list when I click on it.
The system selects the item for you, you don't have to do anything.
>> Actually, I would like to perform an action when the selected item is double-clicked.
When you right click with the mouse you can add an event handler - select the double click from the choices and let the wizard generate the code for you.