I want to execute some code when the user selects a row in a CListCtrl (report view, I don't care about the other viewing modes).
How do I catch this event? is there some message I can map or a method like "OnSelectionChanged" or something like that?
Also try:
BEGIN_MESSAGE_MAP(cDlgRun, CDialog)
ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
END_MESSAGE_MAP()
/* ... */
void cDlgRun::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if ((pNMListView->uChanged & LVIF_STATE)
&& (pNMListView->uNewState & LVIS_SELECTED))
{
// do stuff...
}
}