首先必须先添加NM_CLICK的响应函数了。
1.第一种方法:
必须先设置:LVS_EX_FULLROWSELECT
然后在使用:pNMItemActivate->iItem, pNMItemActivate->iSubItem
2.第二种方法:
DWORD dwPos = GetMessagePos(); CPoint point(LOWORD(dwPos), HIWORD(dwPos)); m_list.ScreenToClient(&point); LVHITTESTINFO lvinfo; lvinfo.pt = point; lvinfo.flags = LVHT_ABOVE; int nItem = m_list.SubItemHitTest(&lvinfo); if (nItem != -1) { CString str; str.Format(L"第%d行,第%d列 ", lvinfo.iItem, lvinfo.iSubItem); AfxMessageBox(str); }