初学VC,请教在MFC生成的对话框模板程序中,如何屏蔽Enter键或ESC键?
一些VC编程书上举例时常常是用对话框作窗口,然后在上面放一些控件来演示功能。一般要把OK按钮和Cancel按钮去掉。我想问的为什么执行时还能响应Enter键和ESC键动作使窗口关闭从而退出程序?
下面是拷贝的部分代码,我也不知是不是要改动这部分,望赐教,谢谢!!
/////////////////////////////////////////////////////////////////////////////
// CSDApp initialization
BOOL CSDApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CSDDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}