WCHAR temp[50];
int nSel = ((CComboBox*)GetDlgItem(IDC_COMBO_IP))->GetCurSel();
if(nSel==CB_ERR)
return;
((CComboBox*)GetDlgItem(IDC_COMBO_IP))->GetLBText(nSel,temp);
USES_CONVERSION;
char *mytemp = W2A(temp);
本文介绍如何使用 CComboBox 控件获取当前选中的文本项,并将其转换为 char 类型以便进一步处理。通过 GetCurSel 和 GetLBText 方法确定选中项,并利用 W2A 函数实现 WCHAR 到 char 的转换。
WCHAR temp[50];
int nSel = ((CComboBox*)GetDlgItem(IDC_COMBO_IP))->GetCurSel();
if(nSel==CB_ERR)
return;
((CComboBox*)GetDlgItem(IDC_COMBO_IP))->GetLBText(nSel,temp);
USES_CONVERSION;
char *mytemp = W2A(temp);

被折叠的 条评论
为什么被折叠?