Valhalla Legends Archive

Programming => General Programming => C/C++ Programming => Topic started by: Okee on December 04, 2004, 06:07 PM

Title: Multiple ComboBox (ComboList)'s on one dialog
Post by: Okee on December 04, 2004, 06:07 PM
I have two combobox's on one dialog and I'm processing the CBN_SELCHANGE message inside WM_COMMAND. When I change one combobox, it gets mixed up with my other combobox operations within the same WM_COMMAND. Is there a way to tell which combobox is being switched?
Title: Re: Multiple ComboBox (ComboList)'s on one dialog
Post by: Zakath on December 04, 2004, 06:53 PM
The short answer: yes.















The long answer...check the low order word of the wParam (the high order word contains the CBN_SELCHANGE constant).
Title: Re: Multiple ComboBox (ComboList)'s on one dialog
Post by: Okee on December 04, 2004, 10:15 PM
so it might look something similar to:



case WM_COMMAND:
{
           switch((HIWORD)wParam)
            {
                 case IDC_COMBOBOX1:
                        switch((LOWORD)wParam)
                        {
                                  case CBN_SELCHANGE:
                                   break;
                        }
                        break;
                 case IDC_COMBOBOX2:
                        switch((LOWORD)wParam)
                        {
                                  case CBN_SELCHANGE:
                                   break;
                        }
                         break;
            }

}



... ? I don't know what to look for within the HIWORD.
Title: Re: Multiple ComboBox (ComboList)'s on one dialog
Post by: UserLoser. on December 04, 2004, 10:30 PM
Try:

HIWORD(wParam)
Title: Re: Multiple ComboBox (ComboList)'s on one dialog
Post by: Okee on December 04, 2004, 10:47 PM
Hmm. MSDN says something about the HWND of the control being in the lParam. I don't seem to be able to do it though. ahhh.
Title: Re: Multiple ComboBox (ComboList)'s on one dialog
Post by: Zakath on December 04, 2004, 11:39 PM
You have it backwards. Check the LOWORD(wParam). That will be the constant identifying the combo box.
Title: Re: Multiple ComboBox (ComboList)'s on one dialog
Post by: Okee on December 14, 2004, 08:33 PM
Quote from: Okee on December 04, 2004, 10:15 PM
so it might look something similar to:



case WM_COMMAND:
{
           switch((HIWORD)wParam)
            {
                 case IDC_COMBOBOX1:
                        switch((LOWORD)wParam)
                        {
                                  case CBN_SELCHANGE:
                                   break;
                        }
                        break;
                 case IDC_COMBOBOX2:
                        switch((LOWORD)wParam)
                        {
                                  case CBN_SELCHANGE:
                                   break;
                        }
                         break;
            }

}



... ? I don't know what to look for within the HIWORD.

Once again, I tried something similar to this method. I'm not quite sure where to check within the loword. Will I just be looking for the name of the combobox? I'm confused still, and it has been a week or so. :-(
Title: Re: Multiple ComboBox (ComboList)'s on one dialog
Post by: Zakath on December 14, 2004, 09:07 PM
What are the resource constants defined for the combo boxes? IDC_COMBOBOX1 and IDC_COMBOBOX2?

If so, do something like this:


case WM_COMMAND:
switch( HIWORD(wParam) ) {
case CBNSELCHANGE:
switch( LOWORD(wParam) ) {
case IDC_COMBOBOX1:
doStuff();
break;
case IDC_COMBOBOX2:
doOtherStuff();
break;
default:
break;
}
break;
default:
break;
}
Title: Re: Multiple ComboBox (ComboList)'s on one dialog
Post by: Okee on December 15, 2004, 10:54 AM
Nice, it's workin now. Thanks.