Openvpn
- VB.NET
Sie verwenden einen veralteten Browser (%browser%) mit Sicherheitsschwachstellen und können nicht alle Funktionen dieser Webseite nutzen.
Hier erfahren Sie, wie einfach Sie Ihren Browser aktualisieren können.
Hier erfahren Sie, wie einfach Sie Ihren Browser aktualisieren können.
Es gibt 3 Antworten in diesem Thema. Der letzte Beitrag () ist von backtothetoast.
-
-
google.de > [VB.NET] VPN-Verbindung herstellen
-
sorry dass ich so spät antworte...
ich bin zu dumm für alles...
also: was ich irgendwo gefunden hab :Spoiler anzeigen VB.NET-Quellcode
- Option Explicit On
- Option Strict On
- Option Compare Binary
- Imports Microsoft.VisualBasic
- Imports System.Diagnostics
- Imports System.Threading
- Imports System.Windows.Forms
- ' <remarks>
- ' Hauptformular der Anwendung.
- ' </remarks>
- Public Class MainForm
- Inherits System.Windows.Forms.Form
- Private m_Process As Process
- Private m_OutputThread As Thread
- Private m_ErrorThread As Thread
- Private m_strTextToAdd As String
- #Region " Windows Form Designer generated code "
- Public Sub New()
- MyBase.New()
- InitializeComponent()
- End Sub
- Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
- Private components As System.ComponentModel.IContainer
- Friend WithEvents txtCommandInput As System.Windows.Forms.TextBox
- Friend WithEvents txtConsole As System.Windows.Forms.TextBox
- Friend WithEvents btnSend As System.Windows.Forms.Button
- <System.Diagnostics.DebuggerStepThrough()> _
- Private Sub InitializeComponent()
- Me.txtCommandInput = New System.Windows.Forms.TextBox()
- Me.btnSend = New System.Windows.Forms.Button()
- Me.txtConsole = New System.Windows.Forms.TextBox()
- Me.SuspendLayout()
- '
- 'txtCommandInput
- '
- Me.txtCommandInput.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
- Or System.Windows.Forms.AnchorStyles.Right)
- Me.txtCommandInput.Location = New System.Drawing.Point(16, 352)
- Me.txtCommandInput.Name = "txtCommandInput"
- Me.txtCommandInput.Size = New System.Drawing.Size(462, 20)
- Me.txtCommandInput.TabIndex = 1
- Me.txtCommandInput.Text = ""
- '
- 'btnSend
- '
- Me.btnSend.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right)
- Me.btnSend.FlatStyle = System.Windows.Forms.FlatStyle.System
- Me.btnSend.Location = New System.Drawing.Point(486, 350)
- Me.btnSend.Name = "btnSend"
- Me.btnSend.Size = New System.Drawing.Size(64, 24)
- Me.btnSend.TabIndex = 2
- Me.btnSend.Text = "&Senden"
- '
- 'txtConsole
- '
- Me.txtConsole.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
- Or System.Windows.Forms.AnchorStyles.Left) _
- Or System.Windows.Forms.AnchorStyles.Right)
- Me.txtConsole.Font = New System.Drawing.Font("Courier New", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.txtConsole.Location = New System.Drawing.Point(16, 16)
- Me.txtConsole.Multiline = True
- Me.txtConsole.Name = "txtConsole"
- Me.txtConsole.ReadOnly = True
- Me.txtConsole.ScrollBars = System.Windows.Forms.ScrollBars.Both
- Me.txtConsole.Size = New System.Drawing.Size(534, 326)
- Me.txtConsole.TabIndex = 3
- Me.txtConsole.Text = ""
- '
- 'MainForm
- '
- Me.AcceptButton = Me.btnSend
- Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
- Me.ClientSize = New System.Drawing.Size(568, 390)
- Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtConsole, Me.btnSend, Me.txtCommandInput})
- Me.MinimumSize = New System.Drawing.Size(576, 424)
- Me.Name = "MainForm"
- Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
- Me.Text = "RedirectConsole"
- Me.ResumeLayout(False)
- End Sub
- #End Region
- ' <summary>
- ' Schreibt den im Parameter <paramref name="strText"/>
- ' angebenen Text auf den Ausgabestrom.
- ' </summary>
- ' <param name="strText">Text, der auf den Ausgabestrom
- ' geschrieben werden soll.</param>
- Private Sub StreamInput(ByVal strText As String)
- m_Process.StandardInput.WriteLine(strText)
- m_Process.StandardInput.Flush()
- End Sub
- ' <summary>
- ' Liest vom Fehlerstream und gibt die
- ' gelesenen Informationen aus.
- ' </summary>
- Private Sub StreamError()
- Dim strLine As String = _
- m_Process.StandardError.ReadLine()
- Try
- Do While strLine.Length >= 0
- strLine = m_Process.StandardError.ReadLine()
- If strLine.Length <> 0 Then
- AddText(strLine)
- End If
- Loop
- Catch
- AddText("cmd wurde beendet!")
- End Try
- End Sub
- ' <summary>
- ' Liest vom Ausgabestream und gibt
- ' die gelesenen Informationen aus.
- ' </summary>
- Private Sub StreamOutput()
- Dim strLine As String = _
- m_Process.StandardOutput.ReadLine()
- Try
- Do While strLine.Length >= 0
- If strLine.Length <> 0 Then
- AddText(strLine)
- End If
- strLine = m_Process.StandardOutput.ReadLine()
- Loop
- Catch
- AddText("cmd wurde beendet!")
- End Try
- End Sub
- ' <summary>
- ' Fügt den im Parameter <paramref name="strText"/>
- ' übergebenen String einer TextBox an.
- ' </summary>
- ' <param name="strText">Text, der der TextBox
- ' hinzugefügt werden soll.</param>
- Private Sub AddText(ByVal strText As String)
- m_strTextToAdd = strText
- Me.Invoke(CType(AddressOf Me.AddTextToTextBox, MethodInvoker))
- End Sub
- ' <summary>
- ' Wird über Invoking aufgerufen, um einen Text hinzuzufügen.
- ' <summary>
- Private Sub AddTextToTextBox()
- txtConsole.AppendText(String.Concat(m_strTextToAdd, _
- ControlChars.NewLine))
- txtConsole.SelectionStart = txtConsole.Text.Length
- End Sub
- Private Sub MainForm_Load( _
- ByVal sender As System.Object, _
- ByVal e As System.EventArgs) _
- Handles MyBase.Load
- ' Um das Programm zu benutzen, um einen
- ' Shell-Befehl auf der Konsole auszuführen
- ' (z.B. netstat oder ping) kann man anstelle
- ' von "cmd" bei Arguments einfach den
- ' entsprechenden Befehl (z.B. "ping") einfügen
- ' und in der Eigenschaft Arguments
- ' die entsprechenden Attribute
- ' (beispielsweise bei ping die IP-Adresse) angeben.
- m_Process = New Process()
- With m_Process.StartInfo
- .FileName = "cmd"
- .Arguments = ""
- .UseShellExecute = False
- .CreateNoWindow = True
- .RedirectStandardOutput = True
- .RedirectStandardError = True
- .RedirectStandardInput = True
- End With
- m_Process.Start()
- ' Ändern der Streams, sodass wir bei
- ' Änderungen etwas mitbekommen.
- Dim ts1 As ThreadStart = New ThreadStart(AddressOf StreamOutput)
- m_OutputThread = New Thread(ts1)
- m_OutputThread.Start()
- Dim ts2 As ThreadStart = New ThreadStart(AddressOf StreamError)
- m_ErrorThread = New Thread(ts2)
- m_ErrorThread.Start()
- End Sub
- Private Sub btnSend_Click( _
- ByVal sender As System.Object, _
- ByVal e As System.EventArgs) _
- Handles btnSend.Click
- StreamInput(txtCommandInput.Text)
- txtCommandInput.Clear()
- End Sub
- Private Sub MainForm_Closing( _
- ByVal sender As Object, _
- ByVal e As System.ComponentModel.CancelEventArgs) _
- Handles MyBase.Closing
- m_OutputThread.Abort()
- m_ErrorThread.Abort()
- End Sub
- End Class
also er liest alles bis da aus:
das mit username kommt nimmer...
Wie komm ich zu dem username und passwort?Wer Rechtschreibfehler findet darf sie behalten -
-
Ähnliche Themen
-
2 Benutzer haben hier geschrieben
- WeLoveBurgers (2)
- Gast (2)