////////////////////////////////////////////////////////////////////////////// // MFC Tip #5 -- Vision X Software -- http://www.visionx.com/mfcpro // Preventing the RETURN key from firing the OK button // // This source code is provided for instructional purposes, and is released // to the public domain. No claim of ownership is made. Use it at your own // risk. No warranties are expressed or implied. The resulting program may // not be fully functional. No animals were used to test this code. ////////////////////////////////////////////////////////////////////////////// // This function is called when OK button is actually clicked. void CMyDialog::OnClickedOk() { if (/* all dialog data entered properly */) { CDialog::OnOK(); } else { // Display appropriate error messages. } } // This function is called when user hits RETURN anywhere in dialog. void CMyDialog::OnOK() { // Do nothing. }