我使用下面的代码来禁用完美运行的信息亭应用程序的任务管理器
public void DisableTaskManager()
{
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("DisableTaskManager" + ex.ToString());
}
}
但是当我在操作系统强化的机器中运行它时,我收到以下错误,
DisableTaskManagerSystem.UnauthorizedAccessException:
Access to the registry key 'HKey_Current_User\Software\Mictrosoft\Windows\CurrentVersion\Policies\System' is denied.
at Microsoft.win32.RegistryKey.win32Error(int32 errorcode, String str)
我怎样才能克服这个问题?我需要为信息亭应用程序执行此操作。
看看这个,我还不是一个足够好的 C# 开发人员来发表评论,但我知道在我与其他开发人员一起工作期间,他们在 Windows 7 中遇到了 UAC,如果这就是这里讨论的内容。
http://www.aneef.net/2009/06/29/request-uac-elevation-for-net-application-management-code/ http://www.aneef.net/2009/06/29/request-uac-elevation-for-net-application-managed-code/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)