-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a button that pops open your current default browser window to display anything currently in the embeded browser as it has security limitations If run with sufficent privlidges it will now do a better job at setting the appropriate registry settings for IE Browser emulation.
- Loading branch information
Showing
9 changed files
with
378 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
|
||
namespace ADD.Tools | ||
{ | ||
public class WebBrowserHelper | ||
{ | ||
|
||
|
||
public static int GetEmbVersion() | ||
{ | ||
int BrowserVer; | ||
|
||
// get the installed IE version | ||
using (WebBrowser Wb = new WebBrowser()) | ||
BrowserVer = Wb.Version.Major; | ||
|
||
// set the appropriate IE version | ||
if (BrowserVer >= 11) | ||
return 11001; | ||
else if (BrowserVer == 10) | ||
return 10001; | ||
else if (BrowserVer == 9) | ||
return 9999; | ||
else if (BrowserVer == 8) | ||
return 8888; | ||
else | ||
return 7000; | ||
} // End Function GetEmbVersion | ||
|
||
public static void FixBrowserVersion() | ||
{ | ||
string appName = System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().Location); | ||
FixBrowserVersion(appName); | ||
} | ||
|
||
public static void FixBrowserVersion(string appName) | ||
{ | ||
FixBrowserVersion(appName, GetEmbVersion()); | ||
} // End Sub FixBrowserVersion | ||
|
||
// FixBrowserVersion("<YourAppName>", 9000); | ||
public static void FixBrowserVersion(string appName, int ieVer) | ||
{ | ||
FixBrowserVersion_Internal("HKEY_LOCAL_MACHINE", appName + ".exe", ieVer); | ||
FixBrowserVersion_Internal("HKEY_CURRENT_USER", appName + ".exe", ieVer); | ||
FixBrowserVersion_Internal("HKEY_LOCAL_MACHINE", appName + ".vshost.exe", ieVer); | ||
FixBrowserVersion_Internal("HKEY_CURRENT_USER", appName + ".vshost.exe", ieVer); | ||
} // End Sub FixBrowserVersion | ||
|
||
private static void FixBrowserVersion_Internal(string root, string appName, int ieVer) | ||
{ | ||
try | ||
{ | ||
//For 64 bit Machine | ||
if (Environment.Is64BitOperatingSystem) | ||
Microsoft.Win32.Registry.SetValue(root + @"\Software\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", appName, ieVer); | ||
else //For 32 bit Machine | ||
Microsoft.Win32.Registry.SetValue(root + @"\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", appName, ieVer); | ||
|
||
|
||
} | ||
catch (Exception) | ||
{ | ||
// some config will hit access rights exceptions | ||
// this is why we try with both LOCAL_MACHINE and CURRENT_USER | ||
} | ||
} // End Sub FixBrowserVersion_Internal | ||
|
||
|
||
|
||
|
||
} | ||
} |