I am working on a Kiosk application, i need to disable the taskmanager. So that when the user press [ctrl + alt + Del] and [ctrl + shift + escape], the taskmanager should not pop up. How ?
+4
A:
You can do it by changing the group policy settings.
http://tamaspiros.co.uk/2007/12/20/c-disable-ctrl-alt-del-alt-tab-alt-f4-start-menu-and-so-on/
public void KillCtrlAltDelete()
{
RegistryKey regkey;
string keyValueInt = "1";
string subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System";
try
{
regkey = Registry.CurrentUser.CreateSubKey(subKey);
regkey.SetValue("DisableTaskMgr", keyValueInt);
regkey.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Sam
2010-06-04 02:24:57
Beat me and much more nicely factored than mine :)
fmark
2010-06-04 02:27:27
@Sam, It is possible to enable it back ?
Anuya
2010-06-04 02:30:31
@srk, sure, just remove the registry value.
Sam
2010-06-04 02:31:17
@Sam, Remove the registry value ? How ?
Anuya
2010-06-04 02:33:25
@srk, use `RegistryKey.DeleteSubKey`
Sam
2010-06-04 02:38:16
@srk Or set the value to 0 instead of 1
fmark
2010-06-04 03:51:59
+1
A:
Just set the appropriate registry key:
public void SetRegistryKey(Microsoft.Win32.RegistryKey regHive, string regKey, string regName, string regValue)
{
bool response = false;
Microsoft.Win32.RegistryKey key = regHive.OpenSubKey(regKey);
if (key == null)
{
regHive.CreateSubKey(regKey, Microsoft.Win32.RegistryKeyPermissionCheck.ReadWriteSubTree);
}
key = regHive.OpenSubKey(regKey,true);
key.SetValue(regName, (string)regValue);
}
SetRegistryKey(RegistryHive.CurrentUser, "Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", 1)
fmark
2010-06-04 02:26:14