'
'
Imports System
Imports System.Windows
Imports Microsoft.Win32
Imports System.Reflection
Class Application
Private Sub Application_Startup(sender As Object, e As StartupEventArgs)
Dim wnd As New MainWindow
Dim subKeyName As String = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_WEBSOCKET_MAXCONNECTIONSPERSERVER"
Dim valueName As String = Assembly.GetExecutingAssembly().GetName().Name + ".exe"
SetRegistryValue(subKeyName, valueName, &H80, RegistryValueKind.DWord)
If (e.Args.Length = 1) Then
wnd = New MainWindow(e.Args(0))
Else
wnd = New MainWindow()
End If
MainWindow = wnd
wnd.Show()
End Sub
Public Sub SetRegistryValue(registrySubKeyName As String, valueName As String, valueToSet As Object, registryKind As RegistryValueKind)
Try
Dim currentValueInRegistry As Object = Registry.GetValue(registrySubKeyName, valueName, Nothing)
If Not valueToSet.Equals(currentValueInRegistry) Then
Registry.SetValue(registrySubKeyName, valueName, valueToSet, registryKind)
End If
Catch e As Exception
Console.WriteLine("Exception occurred: " + e.Message)
End Try
End Sub
End Class