POSITION pos=m_ctlFindList.GetFirstSelectedItemPosition(); if(pos==NULL) { MessageBox(_T("Please choose a record"),_T("Warning"),MB_ICONWARNING); return; } if(pos!=NULL) { int item=m_ctlFindList.GetNextSelectedItem(pos); dlg.m_strName=m_ctlFindList.GetItemText(item,1);
if(pos==NULL)
{
MessageBox(_T("Please choose a record"),_T("Warning"),MB_ICONWARNING);
return;
}
if(pos!=NULL)
{
int item=m_ctlFindList.GetNextSelectedItem(pos);
dlg.m_strName=m_ctlFindList.GetItemText(item,1);
int nItem = listctrl.GetNextItem (-1, LVNI_SELECTED);
//取消选中
listctrl.SetItemState(nItem,NULL,NULL);
//设置选中
listctrl.SetItemState(nItem+1,LVNI_SELECTED,LVNI_SELECTED);
int nItem = listctrl.GetNextItem (-1, LVNI_SELECTED);
//取消选中
listctrl.SetItemState(nItem,NULL,NULL);
//设置选中
listctrl.SetItemState(nItem+1,LVNI_SELECTED,LVNI_SELECTED);