I would like to obtain a list, using C#, of all progis's on my computer. I know I can scan the registry, something like this:
var regClis = Registry.ClassesRoot.OpenSubKey("CLSID");
var progs = new List<string>();
foreach (var clsid in regClis.GetSubKeyNames()) {
var regClsidKey = regClis.OpenSubKey(clsid);
var ProgID = regClsidKey.OpenSubKey("ProgID");
var regPath = regClsidKey.OpenSubKey("InprocServer32");
if (regPath == null)
regPath = regClsidKey.OpenSubKey("LocalServer32");
if (regPath != null && ProgID != null) {
var pid = ProgID.GetValue("");
var filePath = regPath.GetValue("");
progs.Add(pid + " -> " + filePath);
regPath.Close();
}
regClsidKey.Close();
}
The code is from this blog.
Does anyone know if there's a simpler way? Also, as far as I understand how this works, the code above would probaly only give me in-process com. What if I need out of process progids as well?
Thanks in advance