Hi!
If you will block the form's "Closing" then you'll
have problem with killing its thread.
I've got much more "safe" proposition for you.
I have written a small program and I want the user to close it down solely by
clicking on a button. How can I disable the ALT+F4 method of closing the
application down?
You can handle "Alt+F4" KeyDown to disable it.
1. set "KeyPreview" of your form to "true"
2. add "KeyDown" handler for your form (or override "OnKeyDown" method)
private void Form1_KeyDown(object sender
, System.Windows.Forms.KeyEventArgs e) {
if( e.Alt && e.KeyCode==Keys.F4 ) {
e.Handled=true;
}
}
Cheers!
Marcin