Solved

How to prevent closing of dialog box on Esc key?

Posted on 2000-02-26
1
323 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
1 Comment
 

Accepted Solution

by:
coreyfrost earned 50 total points
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now