MUS MUS - 11 months ago 97 Question

Get a list of installed programs with application icons

I need to get a list of installed program on local machine with application icons. Below is the code snippet that am using to get the list of installed program and installed directory path.

/// <summary>
/// Gets a list of installed software and, if known, the software's install path.
/// </summary>
/// <returns></returns>
private string Getinstalledsoftware()
//Declare the string to hold the list:
string Software = null;

//The registry key:
string SoftwareKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(SoftwareKey))
//Let's go through the registry keys and get the info we need:
foreach (string skName in rk.GetSubKeyNames())
using (RegistryKey sk = rk.OpenSubKey(skName))
//If the key has value, continue, if not, skip it:
if (!(sk.GetValue("DisplayName") == null))
//Is the install location known?
if (sk.GetValue("InstallLocation") == null)
Software += sk.GetValue("DisplayName") + " - Install path not known\n"; //Nope, not here.
Software += sk.GetValue("DisplayName") + " - " + sk.GetValue("InstallLocation") + "\n"; //Yes, here it is...
catch (Exception ex)
//No, that exception is not getting away... :P

return Software;

Now the issue is how i can get the installed application icon ?

Thanks in advance.


To determine if its an update, there will be a key called IsMinorUpgrade. This is present and set to a 1 for updates. If it's 0 or not present, then it's not an update.

To get an icon from an executable, use this code:


Public Function IconFromFilePath(filePath As String) As Icon 
    Dim result As Icon = Nothing 
        result = Icon.ExtractAssociatedIcon(filePath) 
    Catch ''# swallow and return nothing. You could supply a default Icon here as well 
    End Try 
    Return result 
End Function 


public Icon IconFromFilePath(string filePath)
    Icon result = null;
    try {
        result = Icon.ExtractAssociatedIcon(filePath);
    } catch { }
    return result;