Solved

Modeless dialog box 'ESC key exit code'

Posted on 1997-07-14
1
319 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
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…

895 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

17 Experts available now in Live!

Get 1:1 Help Now