如何响应键盘的ENTER消息,我调用了虚函数OnKeyDown,可是没有反应,应该怎么办啊,各位大虾?

解决方案 »

  1.   

    重载CWnd::PreTranslateMessage(),在这个函数里做你的事,如这个消息不用再传递,返回TRUE
      

  2.   

    在类向导中映射些函数:
    BOOL CFvSpxx::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if (pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN)
    {
                 //此处即为ENTER消息


    }
    return CFormView::PreTranslateMessage(pMsg);
    }
      

  3.   

    重载PreTranslateMsg():
    BOOL CYourWnd::PreTranslateMessage(MSG* pMsg)
    {
        if(pMsg->message == WM_KEYDOWN)
        {
            if(pMsg->wParam == VK_RETURN)
            {
                ......
            }
        }
        ......
    }
      

  4.   

    营营是男是女/?在OnkeyDown里if(nChar == VK_RETURN)
    {
    ...//@#%^(@#~!~@%^^&(&(
    }