origin8.5圆滑曲线:VC对话框的问题

来源:百度文库 编辑:中科新闻网 时间:2024/05/02 02:14:45
一般建立对话框后,按下Enter键或者Esc键
都是默认的退出程序
我想截获它们的消息,
应该如何呢??
是否要用钩子技术呢??
我的想法是让Esc键等实效,按了也不退出程序

方法一 : 重载 OnCancel
方法二: BOOL C..Dlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN){
switch(pMsg->wParam){
case VK_RETURN://截获回车
return TRUE;
case VK_ESCAPE://截获ESC
// return TRUE;
break;
}
}
return CDialog::PreTranslateMessage(pMsg);
}