Retrouver l'indice de selection d'une ListBox
Voila pour l'instant je rempli une listbox comme ceci:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| CFormView::OnInitialUpdate();
////////////////Remplissage de la Listbox/////////////////////
CListBox* pListBox=static_cast<CListBox*>(GetDlgItem(IDC_LIST1));
pcap_if_t *alldevs;
pcap_if_t *d;
char errbuf[PCAP_ERRBUF_SIZE];
if(pcap_findalldevs(&alldevs, errbuf) == -1)
{
CString buf;
buf.Format("Probleme pour retrouver une interface réseau: %s\n", errbuf);
AfxMessageBox(buf);
}
for(d=alldevs; d; d=d->next)
{
pListBox->AddString( d->description);
} |
J'aimerai bien pouvoir retrouver l'indice correspondant à ma selection.
Dans la FAQ j'ai trouvé quelque chose pour les ComboBox mais pas pour les ListBox