Hi all,
I would am trying to develop an application that will search for a
REG_SZ Key in the registry and print its value on to the screen.
I have got this partly working. In HKEY_LOCAL_MACHINE\SOFTWARE\781 I
created a REG_SZ entry called hell and given it the value of sausages.
A bit random I know.
When I run my program if i set the path in the code to
HKEY_LOCAL_MACHINE\SOFTWARE\781 it will print the value sausages on
the console.
However if i set the path to HKEY_LOCAL_MACHINE\Software it won't find
the value.
I want the program to search through everything in the registry within
HKEY_LOCAL_MACHINE\Software. how would I go about doing this. Below is
the code that I currently have.
private void btnRegedit_Click(object sender, EventArgs e)
{
RegistryKey masterKey = Registry.LocalMachine.CreateSubKey
(@"SOFTWARE\\");
if (masterKey == null)
{
Console.WriteLine("Null Masterkey!");
}
else
{
Console.WriteLine("Hell = {0}", masterKey.GetValue
("Hell"));
}
masterKey.Close();
}
}