I am trying to read another applications registry value but I am not having much success. I have searched a full page and a half of results on Google, but not found what I am looking for.
I am trying to read the following registry value:
\\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\AVG CloudCare\DisplayVersion
A typical value would be: '3.5.3'
I am using this code which I found online:
RegistryKey RegInfo = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\AVG CloudCare", false);
object CCVersionReg = RegInfo.GetValue("DisplayVersion", "0");
Console.WriteLine(CCVersionReg);
Console.ReadLine();
However I always get an error: "Object reference not set to an instance of an object.".
I tried to convert the object to a string like this:
Console.WriteLine(CCVersionReg.ToString);
This also doesn't work, with the error, "Cannot convert to 'method group' from 'bool'.
The reason I need this is to compare this version with the known latest version for an updater application, which I need to use string to compare the values.