0
我想获取值并将值设置为注册表。注册表GetValue函数
当我试图访问不在注册表中的路径时,我正在阅读。
但是,当我使用Registry.SetValue(keyName, "", 0);
设置路径时,所有工作正常,我可以从中获取不存在的值。
任何想法,为什么我不能使用我的public int GetComponent(string RegKey)
功能在修女现有的路径?
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
namespace LP_Misc
{
public class LP_Registery
{
private const string userRoot = "HKEY_CURRENT_USER";
private const string subkey = @"Software\PCBMatrix\LPWizard";
private string keyName ;
public LP_Registery(string folderName)
{
keyName = userRoot + "\\" + subkey + "\\" + folderName;
//Registry.SetValue(keyName, "", 0);
}
public int GetComponent(string RegKey)
{
return (int)Registry.GetValue(keyName, RegKey, 0);
}
public void SetComponent(string RegKey, int RegVal)
{
Registry.SetValue(keyName, RegKey, RegVal, RegistryValueKind.DWord);
}
}
}
如果可能我应该怎么做,这将是可能的。
谢谢。