Solved

How to prevent closing of dialog box on Esc key?

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

837 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