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
Solved

Modeless dialog box 'ESC key exit code'

Posted on 1997-07-14
1
321 Views
Last Modified: 2013-12-03
Hi , still a question with my damned modeless dialog box :).

When i execute from my CmainFrame a modeless dialog box (you know tihtou using DoModel , using Create instead to run it), i didn't found in the classwizard how to disable the ESCAPE key . If the user press ESCAPE in the Modelles dialog box , i dunno how to make the window still visible , and what code is send to the dialog box or to the Main frame window (MDI apI) thanx for da answer ..
0
Comment
Question by:SkizoWalker
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 20 total points
ID: 1400906
Pressing ESC is the same as clicking the Cancel button in a modal or modeless dialog box. You can override CDialog::OnCancel() function.


CDialog::OnCancel

virtual void OnCancel( );
 
Remarks
The framework calls this member function when the user clicks the Cancel button or presses the ESC key in a modal or modeless dialog box.
Override this member function to perform Cancel button action. The default simply terminates a modal dialog box by calling EndDialog and causing DoModal to return IDCANCEL.
If you implement the Cancel button in a modeless dialog box, you must override the OnCancel member function and call DestroyWindow from within it. Don’t call the base-class member function, because it calls EndDialog, which will make the dialog box invisible but not destroy it.


0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

829 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