我是这么做的,但是不行,望高手指点一下:添加listctrl控件的NM_CLICK消息相应函数
void CTest6Dlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
{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 strtemp;
strtemp.Format("单击的是第%d行第%d列", lvinfo.iItem, lvinfo.iSubItem);
AfxMessageBox(strtemp);
}

解决方案 »

  1.   

    用 GetFirstSelectedItemPosition() 方法.
      

  2.   

    int nIndex=m_Combo.GetCurSel();
    if(nIndex!=CB_ERR)
    {
    m_nDrawCombo=m_Combo.GetItemData(nIndex);
            POSITION   pos   =m_List.GetFirstSelectedItemPosition();
    if   (pos   ==   NULL)   
    {   
      //未選中item   
                return   ;   
    }   
           else   
       {   
       //選中一個或多個item   
            CWordArray   ItemArray;   
          while   (pos)   
          {     
                int   nIndex   =   0;   
                nIndex   =   m_List.GetNextSelectedItem(pos);   
                ItemArray.Add((unsigned   short)nIndex);   
          }  
       }
       
    }
    UpdateData(FALSE);
      

  3.   

    //CListCtrl获得选择
    POSITION pos = GetFirstSelectedItemPosition();
    return GetNextSelectedItem(pos);