首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

vc中组合框的有关问题

2012-10-16 
vc中组合框的问题我想在组合框中选中我的网卡列表,然后点击抓包就可以抓包了,但是程序每次运行到我在组合

vc中组合框的问题
我想在组合框中选中我的网卡列表,然后点击抓包就可以抓包了,但是程序每次运行到我在组合框中选完我的网卡后就出现
Micorsoft Vinsual C Debug Library

Debug Assertion Failed! File:afxwin2.inl Line:711错误 

我是基于对话框做的,下面的就是我的组合框的两个函数。
void CText11Dlg::OnDropdownCombo1() 
{
// TODO: Add your control notification handler code here
int i=0;
pcap_if *d;
pcap_if_t *alldevs;
  char errbuf[PCAP_ERRBUF_SIZE];
  pCombo=(CComboBox *)GetDlgItem(IDC_COMBO1);
pCombo->ResetContent();
  pcap_findalldevs(&alldevs,errbuf);
for(d=alldevs;d!=NULL;d=d->next)
{
  if(d->description)/*获得设备的详细描述*/

  pCombo->AddString(d->description);
  // pCombo->SelectString(-1,m_sSelection);
}
}
  pCombo->SelectString(-1,m_sSelection);

}

void CText11Dlg::OnCloseupCombo1() 
{
// TODO: Add your control notification handler code here
CComboBox m_ctrlCombo;
nIndex=m_ctrlCombo.GetCurSel();
if(nIndex!=LB_ERR)

char ch10[10];
m_ctrlCombo.GetLBText(nIndex,m_sSelection);
itoa(nIndex,ch10,10);
  p->m_list.AddString(ch10); //测试nIndex的值
}
  else
{
m_ctrlCombo.ResetContent();
m_ctrlCombo.AddString(m_sSelection);
m_ctrlCombo.SelectString(-1,m_sSelection);
}

}

[解决办法]
加断点调试,一般是某个控件的指针为NULL了

热点排行