0
点赞
收藏
分享

微信扫一扫

C#向注册表添加值


直接上代码

private void SetForceSetCopyCount(string key, object value) 
{
RegistryKey office = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\11.0\Word\Options", true);
if (office != null && office.GetValue("ForceSetCopyCount") == null)
{
office.SetValue(key, value);
}
string[] keyValues = office.GetValueNames();
Console.WriteLine(keyValues);
}

参考链接:
​​​https://social.msdn.microsoft.com/Forums/vstudio/en-US/0ea4e69b-f6cc-4de3-b776-2a1d8bebcf95/opensubkey-return-null-though-the-key-exist?forum=netfxbcl​​


举报

相关推荐

0 条评论