In the application I’ve been working on, I needed to find all browsers that are installed on a user’s machine. The best way to go about this is to look in the registry under HKEYLOCALMACHINE\SOFTWARE\Clients\StartMenuInternet. This is where browser manufacturers are told to put their information, per this MSDN article.  But here’s a gotcha I hit: on 64bit, the keys get written to HKEYLOCALMACHINE\SOFTWARE\WOW6432Node\Clients\StartMenuInternet.

No big deal: just need to check that key first.

So, here’s the code I ended up writing to get the name, file path and icon for the browsers installed on a user’s machine.  (Note that the Browser object is my own class.)

RegistryKey browserKeys; 
//on 64bit the browsers are in a different location
browserKeys = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Clients\StartMenuInternet");
if (browserKeys == null)
browserKeys = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Clients\StartMenuInternet");

string[] browserNames = browserKeys.GetSubKeyNames();

for (int i = 0;i<browserNames.Length;i++)
{ Browser browser = new Browser(); RegistryKey browserKey = browserKeys.OpenSubKey(browserNames[i]); browser.Name = (string) browserKey.GetValue(null); RegistryKey browserKeyPath = browserKey.OpenSubKey(@"shell\open\command"); browser.Path = (string)browserKeyPath.GetValue(null); RegistryKey browserIconPath = browserKey.OpenSubKey(@"DefaultIcon"); browser.IconPath = (string)browserIconPath.GetValue(null); this.Add(browser); }