How do I detect which version of Internet Explorer is installed?

后端 未结 5 953
感动是毒
感动是毒 2020-12-10 13:25

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?

5条回答
  •  情深已故
    2020-12-10 13:57

    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.

提交回复
热议问题