More Related Content
More from Razvan Raducanu, PhD (20)
MFC ELC
- 8. void CELCDlg::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
CEdit* pe = (CEdit*)GetDlgItem(IDC_EDIT1);
CListBox* plb = (CListBox*)GetDlgItem(IDC_LIST1);
CString str;
pe->GetWindowText(str);
plb->AddString(str);
}
- 11. void CELCDlg::OnBnClickedButton2()
{
// TODO: Add your control notification handler code here
CComboBox* pcb = (CComboBox*)GetDlgItem(IDC_COMBO1);
CListBox* plb = (CListBox*)GetDlgItem(IDC_LIST1);
CString str;
int sel = plb->GetCurSel();
if (sel != CB_ERR) {
plb->GetText(sel, str);
pcb->AddString(str);
}
else
MessageBox(_T("Nu ati selectat nimic!"),_T("Message"));
}
- 14. void CELCDlg::OnBnClickedButton3()
{
// TODO: Add your control notification handler code here
CComboBox* pcb = (CComboBox*)GetDlgItem(IDC_COMBO1);
CListBox* plb = (CListBox*)GetDlgItem(IDC_LIST1);
CString str;
for (int i = 0; i < plb->GetCount(); i++) {
plb->GetText(i, str);
pcb->AddString(str);
}
}