Preventing dialogs being closed by ESC

Started by
2 comments, last by Fish HF 20 years, 9 months ago
How do I prevent a dialog being closed by ESC? thanks
Advertisement
Intercept the WM_CLOSE message and return 0, the add a custom button with a non-general ID and allow that to close the dialog. Or you could do some extra testing in the WM_CLOSE handler to see if it was esc that was pressed and forces the dialog to close.
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
If you''re using MFC, try overriding the virtual OnCancel() member function of CDialog.

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming

You are unique. Just like everybody else.

"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

One fast way is to make a IDCANCEL button that is hidden and disabled on your dialog.

This topic is closed to new replies.

Advertisement