im using c# .net 2.0 Console Application.
How can i prevent my console application from ALT+F4 shortcut?
is there any way to do that?
everywhere there is winform solution.
I need console app solution.
please help me
im using c# .net 2.0 Console Application.
How can i prevent my console application from ALT+F4 shortcut?
is there any way to do that?
everywhere there is winform solution.
I need console app solution.
please help me
@Jeroen Mostert:
i found a final working solution from prevent exiting console app by the user.
Everybody says its not possible. But yes it possible with simple tweak.
Here we go
using C#
RegistryKey objRegistryKey = Registry.CurrentUser.CreateSubKey(@"Console");
objRegistryKey.SetValue("AllowAltF4Close", "0" , RegistryValueKind.DWord);
I cant post my full code here due to copyright
but this code works within my application. I tried to make a sample but that not works. But within my full application this works and Nobody can close by pressing ALT+F4.
this is a real solution for all. I don't know which part is required within my all code to make sample.
but this works.
you can just change value 0 to 1 to enable ALT+F4
CMD will not closing if you use this code. try code and launch another cmd. i dont need to launch another CMD. within my code that works for itself.