if (HIWORD(wParam) == CBN_KILLFOCUS)
            {
                i = (int)SendDlgItemMessage(hDlg, LOWORD(wParam),
                    CB_GETCURSEL, 0, 0) ;
                if (i != CB_ERR)
                    gwGain[((USHORT)LOWORD(wParam)) - IDC_CHL0] = i;
            }            return TRUE;

解决方案 »

  1.   

    HIWORD
    The HIWORD macro retrieves the high-order word from the given 32-bit value. WORD HIWORD(
      DWORD dwValue 
    );
    Parameters
    dwValue 
    Specifies the value to be converted. 
    Return Values
    The return value is the high-order word of the specified value. 
      

  2.   

    if (HIWORD(wParam) == CBN_KILLFOCUS)//组合框失去输入焦点
                {
                    i = (int)SendDlgItemMessage(hDlg, LOWORD(wParam),
                        CB_GETCURSEL, 0, 0) ;//The SendDlgItemMessage function sends a message to the specified control in a dialog box.
                    if (i != CB_ERR)//如果返回值为CB_ERR
                        gwGain[((USHORT)LOWORD(wParam)) - IDC_CHL0] = i;//将返回值放赋给数组
                }            return TRUE;
      

  3.   


    如果combo box失去焦点的时候
    {
      获取combo box当前被选中项目的索引,放到变量i中  如果combo box当前没有被选中的项目,执行这条语句:gwGain[((USHORT)LOWORD(wParam)) - IDC_CHL0] = i; }
      

  4.   

    这是【C语言+API】的程序,不是MFC程序。