Private Shared Sub
SetWebBrowserFeatures(ByVal ieVersion As Integer)
If LicenseManager.UsageMode <> LicenseUsageMode.Runtime Then
Return
‘Get the program and name
Dim appName =
System.IO.Path.GetFileName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName)
‘Get the value of the browser‘s mode
Dim ieMode As UInt32 = GeoEmulationModee(ieVersion)
Dim featureC
‘Set the browser to run the app (appName) in what mode (ieMode)
Registry.SetValue(featureControlRegKey &
"FEATURE_BROWSER_EMULATION", appName, ieMode, RegistryValueKind.DWord)
‘enable the features which are "On" for the full Internet
Explorer browser
Registry.SetValue(featureControlRegKey &
"FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION", appName, 1,
RegistryValueKind.DWord)
End Sub
‘get version
Private Shared Function GetBrowserVersion()
As Integer
Dim browserVersion As Integer = 0
Using ieKey =
Registry.LocalMachine.OpenSubKey("SOFTWAREMicrosoftInternet
Explorer", RegistryKeyPermissionCheck.ReadSubTree,
System.Security.AccessControl.RegistryRights.QueryValues)
Dim version = ieKey.GetValue("svcVersion")
If version Is Nothing Then
version = ieKey.GetValue("Version")
If version Is Nothing Then Throw New
ApplicationException("Microsoft Internet Explorer is required!")
End If
Integer.TryParse(version.ToString().Split("."c)(0),
browserVersion)
End Using
If browserVersion < 7 Then
Throw New ApplicationException("Not
Support!")
End If
Return browserVersion
End Function
Private Shared Function
GeoEmulationModee(ByVal browserVersion As Integer) As UInt32
Dim mode As UInt32 = 11000
Select Case browserVersion
Case 7
mode = 7000
Case 8
mode = 8000
Case 9
mode = 9000
Case 10
mode = 10000
Case 11
mode = 11000
End Select
Return mode
End Function