现在 DialogBox上有两个Combobox
分别为 Combobox1, Combobox2
Combobox1有 选项 1, 2, 3
我想让Combobox2 根据Combobox1的变化而变化
比如
Combobox1 Combobox2
1 A, B, C
2 D, E
3 F, G, H要怎么处理
是不是Combobox1在变化后会给主窗口发送什么消息呢?
MSDN上说 是WM_DRAWITEM 但是我测试 没有发送 环境
VC6 非MFC
分别为 Combobox1, Combobox2
Combobox1有 选项 1, 2, 3
我想让Combobox2 根据Combobox1的变化而变化
比如
Combobox1 Combobox2
1 A, B, C
2 D, E
3 F, G, H要怎么处理
是不是Combobox1在变化后会给主窗口发送什么消息呢?
MSDN上说 是WM_DRAWITEM 但是我测试 没有发送 环境
VC6 非MFC
Combo Boxes Messages | SendMessage | CBN_DBLCLK | CB_SETCURSEL | WM_COMMANDRequirements
OS Versions: Windows CE 1.0 and later.
Header: Winuser.h.
This message is sent when the selection in the list box of a combo box is about to be changed as a result of the user either clicking in the list box or changing the selection by using the arrow keys. The parent window of the combo box receives this message through the WM_COMMAND message. CBN_SELCHANGE idComboBox = (int)LOWORD(wParam);
hwndComboBox = (HWND) lParam;--------------------------------case WM_COMMAND:
switch(LOWORD(wParam))
{
case CBN_SELCHANGE:
if(hwndComboBox1 == (HWND)lParam)
{
int nIndex = SendMessage(hwndComboBox1, CB_GETCURSEL, (WPARAM)0, (LPARAM0);
::PostMessage(hwndComboBox2, CB_SETCURSEL, (WPARAM)nIndex , (LPARAM)0);
}
break;
default:
break;
}
break;
选择项触发的好象应该是CBN_SELENDOK消息
可能和我的Combibox是 DropDownList
有关 谢谢各位的答复了