BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message == WM_KEYDOWN) MessageBox("hello"); return CFrameWnd::PreTranslateMessage(pMsg); }
不行的,是不是被CView接收了?
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message==WM_KEYDOWN) { if(pMsg->wParam==VK_RETURN)//响应回车 MessageBox("enter"); .. } return 1; }
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN)
MessageBox("hello");
return CFrameWnd::PreTranslateMessage(pMsg);
}
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN)
{
if(pMsg->wParam==VK_RETURN)//响应回车
MessageBox("enter");
..
}
return 1;
}