vc如何用messagebox输出键盘按下的键,

总结了下……

void CWork3Dlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{

 // TODO: Add your message handler code here and/or call default
    CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
 /*
 char lsChar;
 lsChar=char(nChar);
    MessageBox(&lsChar);
 */

///*重载PreTransMessage虚函数
 MSG *pMsg;
 if(pMsg->message ==WM_KEYDOWN)
 {
  CString str;
  str.Format ("%c",pMsg->wParam);
  AfxMessageBox(str);  
 }

 /**************

/*

 CString str;
 str.Format ("%c",nChar);
 AfxMessageBox(str); 

//这个最简单*/

/***************/

posted on 2011-07-25 10:40  role  阅读(688)  评论(0编辑  收藏  举报