MFC-CListCtrl-GetFirstSelectedItemPosition获取第一个选定项的位置和被选中的下一项
POSITION pos = mylist4.GetFirstSelectedItemPosition(); //获取第一个选定项的位置 /* 返回值:成功 返回行号; 标题栏下的行号是1 NULL,如果项未被选定 */ str.Format(_T("第一个选定项的位置pos=%d\r\n"), pos); OutputDebugString(str); while (pos) { int i = mylist4.GetNextSelectedItem(pos);//获取指定位置的索引 /* 参数1:POSITION 输入时要获取索引的位置,函数成功后,输出下一个选中的位置;没有被选中了输出0 返回值:int 获取pos位置的索引 【i=pos-1】 */ str.Format(_T("pos=%d\r\n"), pos); OutputDebugString(str); str.Format(_T("i=%d\r\n"), i); OutputDebugString(str); }