- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear All,
I have discovered accidentally that when using a (modal) dialog box equipped with the default CANCEL button (ID=IDCANCEL), a CTRL+BREAK event while the dialog box is still displayed causes the dialog to close and return the value that is associated with the CANCEL button. If a callback function for the CANCEL button is registered, then this function gets called when the CTRL+BREAK event occurs.
It there any way I can distinquish betweena CTRL+BREAK event and the CANCEL button actually being pressed?
Thanks for any help.
Evan de Kock
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Evan de Kock
...It there any way I can distinquish betweena CTRL+BREAK event and the CANCEL button actually being pressed?
You can do this by setting a keyboard hook (SetWindowsHookEx) and/or using RegisterHotKeys to send a WM_HOTKEY to your proc for system keys which are un-hookable.
However, it might be simpler to create your own cancel button with an ID other than the default ID_CANCEL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Paul Curtis
You can do this by setting a keyboard hook (SetWindowsHookEx) and/or using RegisterHotKeys to send a WM_HOTKEY to your proc for system keys which are un-hookable.
However, it might be simpler to create your own cancel button with an ID other than the default ID_CANCEL.
Thanks Paul. I will definitely look into the option of setting up a keyboard hook. Furthermore, I have already implemented your alternative suggestion of creating my own cancel button with a ID different than ID_CANCEL. In fact, I have kept the default cancel button (IDCANCEL), but hidden, so that I can use a callback function for it to trap the CNTRL+BREAK event while the dialog is still open. Very dirty, but it works nicely...
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page