Is the best way to look under the Uninstall key of the Windows Registry? Is there a Microsoft API call which provides this info and is it supported from XP onwards?
What is the best way to detect which version of Internet Explorer is installed on the local machine?
I'd like to challenge the conventional wisdom of inspecting the registry. Consider the reference source for System.Windows.Forms.WebView.Version:
string mshtmlPath =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "mshtml.dll");
FileVersionInfofvi = FileVersionInfo.GetVersionInfo(mshtmlPath);
return new Version(
fvi.FileMajorPart, fvi.FileMinorPart, fvi.FileBuildPart, fvi.FilePrivatePart);
Presumably, the guys who wrote the WebView
class knew what they were doing.
You have to look in the registry, but not in uninstall key. Instead,
find the key at HKLM\Software\Microsoft\Internet Explorer
and read the value named Version
.
For newer versions (IE 10 and above), Version
is 9.x (for example, IE 10 is 9.10.something), and the new svcVersion
value gives the true IE version.
This technique is even recommended by Microsoft; see here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With