> I want to write a generic method to read the installed version of
> software based on the exact software name that is displayed in Add /
[quoted text clipped - 7 lines]
>
> TK.
Some examples of what you are seeing and what you want to do would
probably go a long way of helping us help you here.

Signature
Lasse Vågsæther Karlsen
mailto:lasse@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3
Tim - 17 Jan 2008 16:15 GMT
I found a potential solution after a few hours of Google searching.
The code goes through the entire installed apps section in the
registery uninstall section. The apps I'm looking for are displayed
by their product code in InstallShield. I can pass in a string of the
exact app name and it will work even for those that are displayed by
product name using the displayName variable below. Hope this helps
anyone else looking for this type of a solution.
Again, it needs to be tweaked slightly to pass in the app I'm looking
for return the string of the version that I looked for. But it
appears to work. Hopefully I'll meet my deadline:
//Get all installed apps and version numbers
public void GetInstalledApps()
{
string uninstallKey = (@"SOFTWARE\Microsoft\Windows
\CurrentVersion\Uninstall");
string junk = "";
string Version = @"SOFTWARE\Microsoft\Windows
\CurrentVersion\Uninstall";
using (RegistryKey rk =
Registry.LocalMachine.OpenSubKey(uninstallKey))
using (RegistryKey rv =
Registry.LocalMachine.OpenSubKey(Version))
{
string[] skNames = rk.GetSubKeyNames();
int skNamesLen = skNames.Length;
string skName = null;
string[] svNames = rv.GetSubKeyNames();
int svNamesLen = svNames.Length;
string svName = null;
for (int namesIdx = 0; namesIdx < skNamesLen; namesIdx+
+)//
// foreach (string skName in rk.GetSubKeyNames())
{
skName = skNames[namesIdx];
svName = svNames[namesIdx];
using (RegistryKey sk = rk.OpenSubKey(skName))
{
sk.Name.Replace(uninstallKey, ""); //Root
object displayVersion = null, displayName =
null;
using (RegistryKey sv = rv.OpenSubKey(svName))
{
displayVersion =
sv.GetValue("DisplayVersion");
displayName = sv.GetValue("DisplayName");
if (displayVersion != null && displayName !
= null)
{
//displayValue = (+
+counter).ToString();
//TreeNode node = new
TreeNode(displayValue.ToString());
junk = displayVersion.ToString();
junk = displayName.ToString();
//nd1.Nodes.Add(node);
}
}
}
}
}
}
TK.