Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable System Keys?

Status
Not open for further replies.

TheCrappyProgrammer

Programmer
Sep 17, 2001
41
US
How would I disable the escape key? I don't wan't users to be able to exit my program by doing that.
 
This problem only occurs in Dialog Based Projects, or
in dialogs. You can overwrite the OnCancel() function:

void CYourDlg::OnCancel()
{
}

then change the id of the cancel-button and add to this button the original OnCancel:

void CYourDlg::OnCancel()
{
CDialog::OnCancel();
}

In non-dialog-based projects you can alter resource
Accelerator IDR_MAINFRAME
 
Thanks! It worked! But now the Enter key also exits my application. How would I fix that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top