I have a simple windows app consisting of only two forms. This is an intranet app that runs on some specific desktops constantly and users have no control over closing them (among other things).
I want to abe able to associate a key sequecne (let's say Ctl + Esc) to exist the app and also provide an admin password to do so. This is so that admins can close the app and restart it again if necessary.
Thanks.
Loading

Kirtan PatelRank #292 · 8.6K reputationPosted Jun 13, 2010, 12:22 AM EDT
private void Form1_Load(object sender, EventArgs e)
{
this.KeyPreview = true;
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Shift == true && e.KeyData == Keys.E)
{
Application.Exit();
}
}
Mo17 reputationPosted Jun 13, 2010, 6:53 PM EDT
I also found this on the net that allows any key combination to be associated with some action:
http://www.csharpdeveloping.net/Article.mvc/shortcut_manager_-_keyboard_shortcuts_in_winforms_by_win_api