直接写在了CTestDlg的Public里。调用成功
来自http://zhidao.baidu.com/link?url=hBYk833zlWqeiba7PeThMkhZ84gzYutLMDVlOy25rlILwlNyd0qc8RhZbF7fKofv2E-_FBUGEE4xM4yFU_JFa_
BOOL CTestDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_RETURN)//当按下键为回车键时
{
OnButton1();//调用按钮函数
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}