尝试这个:
CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBO1);
CWnd* pComboEdit = pCombo->GetWindow(GW_CHILD);
if (pComboEdit != NULL)
pComboEdit->ModifyStyle(0, ES_NUMBER);
Run Code Online (Sandbox Code Playgroud)
编辑:为了限制字符/数字的数量:
((CEdit*)pComboEdit)->LimitText(4);
Run Code Online (Sandbox Code Playgroud)