我在一个对话框中有两个组合框,问题是我想找出哪个字符串已被选中并从组合框中获取消息。我有以下代码。但问题是,从这段代码中我无法区分选择了哪一个组合框,这个代码导致两个框的索引编号相同。
if(HIWORD(wParam) == CBN_SELCHANGE){
_formatIndex = SendMessage((HWND) lParam, (UINT) CB_GETCURSEL, (WPARAM) 0, (LPARAM) IDD_IMAGES_MODE);
_savingModeIndex = SendMessage((HWND) lParam, (UINT) CB_GETCURSEL, (WPARAM) 0, (LPARAM) IDC_COMBOBOX_TIME_FRAME);
}
答案 0 :(得分:1)
实际上我只是找到答案,这是代码:
if(HIWORD(wParam) == CBN_SELCHANGE){
if(LOWORD(wParam)==IDD_IMAGES_MODE){
_formatIndex = SendMessage((HWND) lParam, (UINT) CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
}
if(LOWORD(wParam)==IDC_COMBOBOX_TIME_FRAME){
_savingModeIndex = SendMessage((HWND) lParam, (UINT) CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
}
}