我现在同一界面上有两个CListBox分别是黑、白名单。以及关于CListBox的操作的按钮
白名单CListBox的选中项删除函数是这个样子的
        int n_count = c_list_white.GetCount();
if(n_count == 0){
return;
}
int *n_index = new int[n_count+1];
int n_selcount;
n_selcount = c_list_white.GetSelItems(n_count, n_index); 
for(int i = n_count; i>=0;--i){ c_list_white.DeleteString(n_index[i]);
}
delete[] n_index;
黑名单CListBox的选中项删除函数是这个 int n_count = c_list_black.GetCount();
if(n_count == 0){
return;
}
LPINT nindex = new int[n_count+1];
int n_selcount = 0;
memset(nindex,0,sizeof(int)*(n_count+1));
n_selcount = c_list_black.GetSelItems(n_count, nindex);
if(n_selcount == LB_ERR){
LPVOID lpMsgBuf;
FormatMessage( 
FORMAT_MESSAGE_ALLOCATE_BUFFER | 
FORMAT_MESSAGE_FROM_SYSTEM | 
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL 
);
AfxMessageBox((LPCTSTR)lpMsgBuf);
LocalFree( lpMsgBuf );
delete[] nindex;
return;
}
for(int i = n_count; i>=0;--i){
c_list_black.DeleteString(nindex[i]);
}
delete[] nindex;
问题:点击黑名单删除的时候删不掉选中的项目,但是白名单删除没有问题