vs2012 MFC 编译时弹出参数错误对话框,还有内存泄露
程序代码:
void CData::SearchList(CString search) { if(search.IsEmpty())//判断是否输入搜索值 { AfxMessageBox(_T("请输入搜索关键词!")); return; } extern CListBox *glistbox; int count=glistbox->GetCount(),i=0,num=0; CString str; for(int j=0;j<count;j++)//遍历listbox { glistbox->GetText(j,str);//获取行 &search; if(str.Find(search)==-1) {//判断是否有搜索的内容 glistbox->DeleteString(j); i++; } } num=count-i; str.Empty(); str.Format(_T("搜索到%d条相关信息!"), num); AfxMessageBox(str); }
调试时会弹出参数错误对话框
Detected memory leaks!
Dumping objects ->
{509} normal block at 0x002897E0, 56 bytes long.
Data: <| 8 ( > 7C ED 92 00 F4 00 00 00 01 CD CD CD 38 98 28 00
{508} normal block at 0x00281768, 32768 bytes long.
Data: <~' 5S > 7E 27 00 00 8C 00 00 00 00 00 00 00 35 53 00 00
{507} normal block at 0x00279728, 32768 bytes long.
Data: < ' 5S > 80 27 00 00 10 01 00 00 00 00 00 00 35 53 00 00
{506} normal block at 0x00279328, 964 bytes long.
Data: < ( > 88 97 28 00 FF FF FF FF 00 00 00 00 00 00 00 00
Object dump complete.