I have an extension that is a dialog box with two combo boxes.
In my dlgprocess in WM_INITDIALOG:
I'm populating both combo boxes.
I want to try and join, or connect the combobox1 index to combobox2, so when I change combobox 1, combobox 2 changes too.
Code:
//combo1
case IDC_COMBO1: {
{
if (HIWORD(wParam) == CBN_SELCHANGE)
{
int index = SendDlgItemMessage(g_hwnd, IDC_COMBO2,
CB_SETCURSEL, (WPARAM)index, (LPARAM)0);
}
return 0;
}
}
Years ago I did this with vb.net like:
Code:
Private Sub ComboBox2_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
ComboBox1.SelectedIndex = ComboBox2.SelectedIndex
Was wondering if it was possible with just plain win32?
Any help would be appreciated.
Edit:
Got it working. Had to get index first.
Code:
case IDC_COMBO2:
{
HWND hwndCB1 = GetDlgItem(g_hwnd, IDC_COMBO1);
HWND hwndCB2 = GetDlgItem(g_hwnd, IDC_COMBO2);
if (HIWORD(wParam) == CBN_SELCHANGE && (LOWORD(wParam) == IDC_COMBO2))
{
int idx;
idx = SendMessage(hwndCB2, CB_GETCURSEL, 0, 0);
SendMessage(hwndCB1, CB_SETCURSEL, idx, 0);
break;
}
}
Many Thanks,
Wyatt