怎么获取listCtrl中选中行的指定列的值

 我来答
追忆小土豆
2017-07-16 · TA获得超过7739个赞
知道大有可为答主
回答量:4890
采纳率:0%
帮助的人:1493万
展开全部
CListCtrl::HitTest
int HitTest( LVHITTESTINFO* pHitTestInfo ) const;
int HitTest( CPoint pt, UINT* pFlags = NULL ) const;
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
Return Value
The index of the item at the position specified by pHitTestInfo, if any,
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
or -1 otherwise.
Parameters
pHitTestInfo
Address of a LVHITTESTINFO structure that contains the position to hit test and that
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
receives information about the results of the hit test.
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
pt
Point to be tested.
pFlags
Pointer to an integer that receives information about the results of the test. See the
海姹网(网址:http://www.seacha.com),标签:CListCtrl怎样获取当前所选中行的index、指定列的值, ClistCtrl,选中,列值
explanation of the flags member of theLVHITTESTINFO structure in the Platform SDK
获取选择的行
//m_List是要处理的对象
int nItem = m_List.GetNextItem(-1, LVNI_SELECTED);
获取指定行指定列的值
m_List.GetItemText(nItem, nSubItem);
允许多选时,获取选中行进行处理
POSITION pos = m_list.GetFirstSelectedItemPosition();
if (pos == NULL)
{
TRACE0("No items were selected!\n");
}
else
{
while (pos)
{
int nItem = m_list.GetNextSelectedItem(pos);
TRACE1("Item %d was selected!\n", nItem);
// you could do your own processing on nItem here
}
}
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式