Solved

How to prevent closing of dialog box on Esc key?

Posted on 2000-02-26
1
369 Views
Last Modified: 2013-11-20
I have developed a Dialog based mfc application,using VC6.
  The problem is that if an escape key is pressed,the dialog based application exits.How can I prevent this from happening?
   
0
Comment
Question by:sjhunjhunuwala
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
coreyfrost earned 50 total points
ID: 2560647
Just provide an implementation of the virtual function OnCancel in your CDialog based class that does nothing. You can do this easily using class wizard for the object ID IDCANCEL. Here is the code to do it manually.

Add this to your dialog class definition (.h file):

virtual void OnCancel();

Add this to your dialog class implementation (.cpp file):

void CYourDialog::OnCancel()
{
}

If you used ClassWizard to add this method, you will need to remove the line of code it added to call the default implementation of OnCancel.


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question