Skip to content

Instantly share code, notes, and snippets.

@kakopappa
Created August 6, 2015 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kakopappa/f637bea7195b112491d5 to your computer and use it in GitHub Desktop.
Save kakopappa/f637bea7195b112491d5 to your computer and use it in GitHub Desktop.
Get list of install programs with icons in Windows
class AppsUtil
{
public static List<InstalledApp> GetInstalledApps()
{
List<InstalledApp> map = new List<InstalledApp>();
string InstallerKey = @"Installer\Products";
using (RegistryKey installkeys = Registry.ClassesRoot.OpenSubKey(InstallerKey))
{
foreach (string name in installkeys.GetSubKeyNames())
{
using (RegistryKey product = installkeys.OpenSubKey(name))
{
string productName = product.GetValue("ProductName").ToString();
string productIcon = null;
if (product.GetValue("ProductIcon") != null) {
productIcon = product.GetValue("ProductIcon").ToString();
}
if (productName != null && productIcon != null)
{
Icon icon = Icon.ExtractAssociatedIcon(productIcon);
map.Add(new InstalledApp() { Photo = icon.ToBitmap(), Name = productName });
}
}
}
}
return map;
}
}
public class InstalledApp {
public string Name { get; set; }
public Image Photo { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment