Get All ProgID on System for COM Automation
If you want to use Silverlight COM Automation, you need to know the ProgID of your COM component. These are buried in the registry. Here is a snippet that I found (don't remember where) and modified a bit to do 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();
}
regClis.Close();
progs.Sort();
var sw = new StreamWriter(@"c:\ProgIDs.txt");
foreach (var line in progs)
sw.WriteLine(line);
sw.Close();
Are you a Git user? Let me help you make project management with Git simple. Checkout Gitpilot.
Follow me on Twitter: @jprichardson and read my blog on entrepreneurship: Techneur
-JP
comments powered by Disqus