List Control得到选中行的内容,总出现没选中对话框,什么原因?

来源:互联网 发布:淘宝多肉店铺推荐 编辑:程序博客网 时间:2024/04/30 00:41
CString str1;
int nId;
POSITION pos=m_listctrl.GetFirstSelectedItemPosition();
if(pos==NULL)
{
MessageBox("没选中",MB_ICONEXCLAMATION);
return;
}
else
{
nId=(int)m_listctrl.GetNextSelectedItem(pos);
str1=m_listctrl.GetItemText(nId,0);
m_list3.AddString(str1);  
}
0 0
原创粉丝点击