If you have a
CListCtrl
or
CListView
derived class, add a
NM_CLICK
handler to that class. In that handler cast the passed
NMHDR
structure pointer to
LPNMITEMACTIVATE
to get the information on the clicked item and sub-item.
Example:
void CMyListCtrl::OnNMClick(NMHDR * pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE lpnmitem = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
if (lpnmitem->iItem == 1 && lpnmitem->iSubItem == 2)
{
CMyDialog Dlg;
Dlg.DoModal();
}
*pResult = 0;
}