public string result;
public string GetRegData(string regFatherPath, string Value1, string Value1Data, string Value2)
{
RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regFatherPath, false);
if (key != null)
{
foreach (string keyName in key.GetSubKeyNames())
{
try
{
RegistryKey key2 = key.OpenSubKey(keyName, false);
if (key2.GetValue(Value1).ToString() == Value1Data)
{
result = key2.GetValue(Value2).ToString();
break;
}
}
catch { MessageBox.Show(Value1Data + " or " + Value2 + " is not exist."); }
}
return result;
}
else return "Fail";
}