I have a model dialog. I overrided OnCancel function to stop unexpected exiting by pressing ESC button. But this caused a new problem. I can’t close the application by using close (x) button. My implementation of function is:
void MyDlg::OnCancel()
{
}
Closing a dialog effectively cancels it. Since you have disabled close in your OnCancel handler, then nothing will happen.
To disable ESC only, you need to preprocess the keyboard messages: