void CMy2Dlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
// TODO: Add your message handler code here and/or call default
MessageBox("nChar");
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}我想让按下的键值显示出来 比如我按下A则对话框显示A

解决方案 »

  1.   

    CString str = nChar;
    MessageBox(str);
      

  2.   

    BOOL CTst01Dlg::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if(pMsg->message==WM_CHAR)
    {
    CString str;
    str.Format("%c",pMsg->wParam);
    MessageBox(str);
    }
    return CDialog::PreTranslateMessage(pMsg);
    }
      

  3.   


    PreTranslateMessage(MSG* pMsg)这个函数是干嘛用的 怎么用
      

  4.   

    这个函数是不用KeyDown函数  直接用这个函数就行么 
    求讲解PreTranslateMessage(MSG* pMsg)