1.注意,如下代码无法得到行号,返回经常返回-1
int iSelRow = m_listProcTest.GetSelectionMark(); //返回列表中选择的行数
应该在列表的点击事件的响应函数中:
void CDlgTest::OnNMClickListProcesstest(NMHDR *pNMHDR, LRESULT *pResult)
{
// TODO: Add your control notification handler code here
*pResult = 0;
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if(pNMListView->iItem != -1)
{
CString str;
str.Format(TEXT("单击的是第%d行第%d列"),pNMListView->iItem, pNMListView->iSubItem);
//AfxMessageBox(str);
m_RowNum = pNMListView->iItem;
m_colNum = pNMListView->iSubItem;
}
}