本帖最后由 VisualEleven 于 2014-03-03 11:37:07 编辑

解决方案 »

  1.   

    把PreTranslateMessage里的的内容贴出来看看
      

  2.   

    将几个编辑框的ID号码连续BOOL CEAAADlg::PreTranslateMessage(MSG* pMsg)
    {
    // TODO: Add your specialized code here and/or call the base class
    HWND hWnd = pMsg->hwnd;
    TCHAR szName[MAX_PATH] = {0};
    GetClassName(hWnd, szName, _countof(szName));
    if((WM_KEYDOWN == pMsg->message) && (0 == CString(szName).CompareNoCase(_T("Edit"))))
    {
    static UINT uID[] = {IDC_EDIT1, IDC_EDIT2, IDC_EDIT3, IDC_EDIT4, IDC_EDIT5};
    int nIndex = ::GetDlgCtrlID(hWnd) - IDC_EDIT1;
    switch(pMsg->wParam)
    {
    case VK_LEFT:
    --nIndex;
    if(nIndex < 0)
    {
    nIndex = _countof(uID) - 1;
    }
    GetDlgItem(uID[nIndex])->SetFocus();
    return TRUE; case VK_RIGHT:
    nIndex = (++nIndex) % (_countof(uID));
    GetDlgItem(uID[nIndex])->SetFocus();
    return TRUE; default:
    break;
    }
    }
    return CDialog::PreTranslateMessage(pMsg);
    }