mfc_ComboBox_multi - 8BitsCoding/RobotMentor GitHub Wiki

κ° λμ΄νκΈ° λ²νΌμ λλ₯΄λ©΄, μλνΈ λ°μ€ λ° μ½€λ³΄λ°μ€μ λμ΄λ κΈμλ₯Ό λͺ¨λ λμ΄ν΄μ€λ€.

콀보λ°μ€ μμ± μ€μ
void CMFCApplication8Dlg::OnBnClickedShowBtn()
{
int num[11];
// μ΄λ°μμΌλ‘ νλ©΄ λ무 λ
Έκ°λ€
// num[0] = GetDlgItemInt(IDC_EDIT1);
int i, index;
CString str, total_str;
for (i = 0; i < 5; i++) num[i] = GetDlgItemInt(IDC_EDIT1 + i);
// μ΄λ κ² νλ©΄ μ½κ² λλλ€.
// for (i = 0; i < 11; i++) num[i] = GetDlgItemInt(IDC_EDIT1 + i);
// μ μμ λ°©λ²μ μ΄λ κ²(μμ보기 μ½κ²)
CComboBox * p_combo;
for (i = 0; i < 6; i++) {
p_combo = (CComboBox*)GetDlgItem(IDC_COMBO1 + i);
index = p_combo->GetCurSel();
if (index != CB_ERR) {
p_combo->GetLBText(index, str);
num[5 + i] = _wtoi(str);
}
else {
// μ νμ νμ§ μμΌλ©΄ 0
num[5 + i] = 0;
}
}
for (i = 0; i < 11; i++) {
str.Format(L"%d, ", num[i]);
total_str = total_str + str;
}
SetDlgItemText(IDC_NUM_EDIT, total_str);
}