Oct 17, 2003 #1 WebStar Programmer May 1, 2002 69 DE Hi, does anyone knows how can I stop my aplication from being closed with Alt+F4 key combination? Thank you!
Hi, does anyone knows how can I stop my aplication from being closed with Alt+F4 key combination? Thank you!
Oct 17, 2003 #2 msaroka Programmer Feb 11, 2002 5 CA public bool F4 = false; private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.F4 && e.Alt == true) { F4 = true; } } private void Form1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { F4 = false; } private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (F4) e.Cancel = true; } Upvote 0 Downvote
public bool F4 = false; private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.F4 && e.Alt == true) { F4 = true; } } private void Form1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { F4 = false; } private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (F4) e.Cancel = true; }