Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Modeless dialog box 'ESC key exit code'

Posted on 1997-07-14
1
Medium Priority
?
326 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
[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
 
LVL 23

Accepted Solution

by:
chensu earned 60 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
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…
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

715 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