using Microsoft.Win32;
static void WriteRegistry(RegistryKey parentKey, String subKey, String valueName, Object value)
{
RegistryKey key;
try
{
key = parentKey.OpenSubKey(subKey, true);
if(key == null) //If the key doesn't exist.
key = parentKey.CreateSubKey(subKey);
//Set the value.
key.SetValue(valueName, value);
Console.WriteLine("Value:{0} for {1} is successfully written.", value, valueName);
}
catch(Exception e)
{
Console.WriteLine("Error occurs in WriteRegistry" + e.Message);
}
}
static void ReadRegistry(RegistryKey parentKey, String subKey, String valueName, Object value)
{
RegistryKey key;
try
{
key = parentKey.OpenSubKey(subKey, true);
if(key == null) //If the key doesn't exist.
throw new Exception("The registry key doesn't exist");
//Get the value.
value = key.GetValue(valueName);
Console.WriteLine("Value:{0} for {1} is successfully retrieved.", value, valueName);
}
catch(Exception e)
{
Console.WriteLine("Error occurs in ReadRegistry" + e.Message);
}
}
Quelle Microsoft
Hier eine sehr nützliche Quelle :
dort findest du eigentliche die gesamte Hilfe http://msdn.microsoft.com/
------------------
Nobody is perfect
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP