我正在尝试更改'WinHttpSettings'注册表值,但它给出了错误。我尝试过如下
RegistryKey OurKey = Registry.LocalMachine;
//MessageBox.Show(OurKey.ToString());
RegistryKey local = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections");
string value = local.GetValue("WinHttpSettings").ToString();
byte[] b ={ 1, 1, 1, 1 };
if (value != null)
{
local.SetValue("WinHttpSettings",b);
//MessageBox.Show(value.ToString());
}
我在上述代码或任何其他解决方案中所犯的任何错误
在注册表之前,值如下所示:
做完'史蒂夫B'后告诉改变:
RegistryKey local = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections",true);
但我想要的是将第一个图像值更改为“0000”
答案 0 :(得分:0)
更改此行:
RegistryKey local = Registry.LocalMachine.OpenSubKey(
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections",
true
);
特别注意true
作为第二个参数。正如documentation中所解释的那样,它的用途是:
writable Type: System.Boolean
Set to true if you need write access to the
key.