在OnInitDialog()给CListCtrl中填加了几列         m_listwzwx.InsertColumn(0,_T("校区编号"),LVCFMT_LEFT,80);
m_listwzwx.InsertColumn(1,_T("公寓编号"),LVCFMT_LEFT,80);
m_listwzwx.InsertColumn(2,_T("物资编号"),LVCFMT_LEFT,80);
m_listwzwx.InsertColumn(3,_T("物资名称"),LVCFMT_LEFT,150);
m_listwzwx.InsertColumn(4,_T("数量"),LVCFMT_LEFT,80);
m_listwzwx.InsertColumn(5,_T("维修费"),LVCFMT_LEFT,80);
m_listwzwx.InsertColumn(6,_T("维修人"),LVCFMT_RIGHT,80);
m_listwzwx.InsertColumn(7,_T("维修日期"),LVCFMT_LEFT,80);
m_listwzwx.InsertColumn(8,_T("备注"),LVCFMT_LEFT,300);
怎么在CListCtrl中的NM_CLICK的事件中用GetColumn得到点击的列值中或者用别的方法
得到点击的列值!谢谢!

解决方案 »

  1.   

    响应事件LVN_COLUMNCLICK更好一些。
    LVN_COLUMNCLICK
        pnmv = (LPNMLISTVIEW) lParam; typedef struct tagNMLISTVIEW{
        NMHDR   hdr;
        int     iItem;
        int     iSubItem;
        UINT    uNewState;
        UINT    uOldState;
        UINT    uChanged;
        POINT   ptAction;
        LPARAM  lParam;
    } NMLISTVIEW, FAR *LPNMLISTVIEW;Contains information about a list view notification message. This structure is the same as the NM_LISTVIEW structure but has been renamed to fit standard naming conventions. 试试看!
      

  2.   

    //CSelectCircuitDlg 这是一个含有列表控件的对话框类
    void CSelectCircuitDlg::OnColumnclickCircuitlist(NMHDR* pNMHDR, LRESULT* pResult) 
    {
    NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
    // TODO: Add your control notification handler code here
             int nColumn=pNMListView->iSubItem;//获得你单击的列号,从0开始         //下面添加你的处理代码
             

    *pResult = 0;
    }
      

  3.   

    补充:利用classWizard对你的列表ID_SELECT_CIRCUIT(视的ID不同而不同)添加消息LVN_COLUMNCLICK的响应函数
      

  4.   

    不好意思,应该是响应消息HDN_ITEMCHANGED。
    void CSelectCircuitDlg::OnItemchangedCircuitlist(NMHDR* pNMHDR, LRESULT* pResult) 
    {
    HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR; int nColumn=phdn->iItem;//获得你单击的列号,从0开始 *pResult = 0;
    }