• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

MFC - CDialog - Escape Key - Solved - OnCancel()

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Have an program written/created using the MFC wizard dialog app template

Problem is that the F1 key is too close to the Escape key.
Users may hit the Escape key and kill the app.

I can not seem to trap the Escape Key Keydown message.
Does not show as SYSCHAR, SYSCOMMAND, KEYDOWN or Close message.
First time I can detect it is at the DestroyWindow - then it is to late.

Guidance will be greatly appreciated.
 
Originally posted by: EagleKeeper
Got it - Overriding the OnCancel handler
Always a good idea for any dialogs that the user must answer, since even if you delete [Cancel] the [x] and escape key still send IDCANCEL which has a default handler in CDialog.
 
Back
Top