1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
// Auto-detect last version of Internet Explorer
string VersionIE = "";
if (Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer", "svcVersion", "Not Exist").ToString() == "Not Exist") {
var CheckVersionIE = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Internet Explorer").GetValue("Version").ToString();
string[] FoundedVersionIE = CheckVersionIE.Split('.');
VersionIE = FoundedVersionIE[0];
} else {
var ChecksvcVersionIE = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Internet Explorer").GetValue("svcVersion").ToString();
string[] FoundedsvcVersionIE = ChecksvcVersionIE.Split('.');
VersionIE = FoundedsvcVersionIE[0];
}
// Use Last IE Version
RegistryKey registrybrowser = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true);
if (registrybrowser == null) {
RegistryKey registryFolder = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl", true);
registrybrowser = registryFolder.CreateSubKey("FEATURE_BROWSER_EMULATION");
}
if (VersionIE == "11") {
registrybrowser.SetValue("appli.exe", 0x2AF8, RegistryValueKind.DWord);
registrybrowser.SetValue("appli.exe", 0x2AF8, RegistryValueKind.DWord);
}
if (VersionIE == "10") {
registrybrowser.SetValue("appli.exe", 0x02710, RegistryValueKind.DWord);
registrybrowser.SetValue("appli.vshost.exe", 0x02710, RegistryValueKind.DWord);
}
if (VersionIE == "9") {
registrybrowser.SetValue("appli.exe", 0x2328, RegistryValueKind.DWord);
registrybrowser.SetValue("appli.vshost.exe", 0x2328, RegistryValueKind.DWord);
}
if (VersionIE == "8") {
registrybrowser.SetValue("appli.exe", 0x1F40, RegistryValueKind.DWord);
registrybrowser.SetValue("appli.vshost.exe", 0x1F40, RegistryValueKind.DWord);
}
if (VersionIE == "7") {
registrybrowser.SetValue("appli.exe", 0x1B58, RegistryValueKind.DWord);
registrybrowser.SetValue("appli.vshost.exe", 0x1B58, RegistryValueKind.DWord);
}
registrybrowser.Close(); |
Partager