Weis jemand wie man Programmgesteuert unter Windows 2000 die Lan Verbindung kurz deaktiviert und wieder aktiviert. Danke fuer eure Hilfe.
Announcement
Collapse
No announcement yet.
Lan Verbindung deakt/aktiv
Collapse
X
-
Hallo,<br>teste doch mal mit NETSH<br><br>
<p class=MsoNormal>@ECHO OFF</p>
<p class=MsoNormal>ECHO *** INTERNET AKTIVIEREN ***</p>
<p class=MsoNormal>REM INTERNET EINSCHALTEN</p>
<p class=MsoNormal>netsh interface ip set address
name="LAN-Verbindung" source=dhcp </p>
<p class=MsoNormal>netsh interface ip set dns name="LAN-Verbindung"
source=static addr=192.168.1.1</p>
<p class=MsoNormal>netsh interface ip add dns name="LAN-Verbindung"
addr=192.168.1.2</p>
<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o></o></p>
<br>
<p class=MsoNormal>@ECHO OFF<o></o></p>
<p class=MsoNormal>ECHO *** INTERNET DEAKTIVIEREN ***<o></o></p>
<p class=MsoNormal>REM INTERNET ABSCHALTEN DURCH FALSCHEN GATEWAY<o></o></p>
<p class=MsoNormal>netsh interface ip set address
name="LAN-Verbindung" source=dhcp<o></o></p>
<p class=MsoNormal>netsh interface ip set dns name="LAN-Verbindung"
source=static addr=192.168.1.253<o></o></p>
<p class=MsoNormal>netsh interface ip add dns name="LAN-Verbindung"
addr=192.168.1.254</p>
<br>"LAN-VERBINDUNG" musst du deinem Eintrag in Netzwerkverbindungen anpassen! (Die IP natürlich auch!)<br>Die beiden "Teile" jeweils in eine Datei mit endung .cmd reinkopieren und dann einfach anklicken.<br><br>Michael<br><br><b>Ich habe mal NEOBROTHERS besucht... Wo kann man den Source von RACEKING bekommen ??? <br>Kannst du mir den zumailen? [email protected]
Comment
-
Hallo, nach langer suche habe ich das hier gefunden
<PRE>
' Switch Boolean (Scope: form or module level)
Dim LANEnable As Boolean = True
' ***** Either placed within a button or routine *****
' Control Panel Identifier
Const ssfCONTROLS = 3
' Enter the name of the connection to manipulate
Dim ConnectionName As String = "Local Area Connection"
Dim EnableVerb As String = "En&able"
Dim DisableVerb As String = "Disa&ble"
' Generate Shell item
Dim ShellApp As New Shell32.Shell()
' Obtain the CP
Dim ControlPanel As Shell32.Folder = ShellApp.NameSpace(ssfCONTROLS)
Dim FolderItem As Shell32.FolderItem
Dim NetworkFolder As Shell32.Folder
Dim LANConnection As Shell32.FolderItem
' Loop through the items in the control panel and obtain the Network Connections folder
For Each FolderItem In ControlPanel.Items()
Debug.WriteLine("Loop 1: " & FolderItem.Name)
If FolderItem.Name = "Network Connections" Then
' When found - exit the loop
NetworkFolder = FolderItem.GetFolder
Exit For
End If
Next
' Debug check
If NetworkFolder Is Nothing Then
MessageBox.Show("Error - No network folder found")
Exit Sub
End If
' Obtain the appropriate connection record
For Each FolderItem In NetworkFolder.Items()
Debug.WriteLine("Loop 2: " & FolderItem.Name)
If FolderItem.Name = ConnectionName Then
' When found - exit the loop
LANConnection = FolderItem
Exit For
End If
Next
' Debug check
If LANConnection Is Nothing Then
MessageBox.Show("Error - No LAN entry was not found")
Exit Sub
End If
' Swtich the LAN toggle
LANEnable = Not LANEnable
Dim EnableVerbItem, DisableVerbItem, Verb As Shell32.FolderItemVerb
' Run through all available options and obtain the appropriate action
For Each Verb In LANConnection.Verbs
Debug.WriteLine("Loop 3: " & Verb.Name)
If Verb.Name = EnableVerb Then
EnableVerbItem = Verb
End If
If Verb.Name = DisableVerb Then
DisableVerbItem = Verb
End If
Next
' Perform the enable / disable
If LANEnable Then
EnableVerbItem.DoIt()
Else
DisableVerbItem.DoIt()
End If
</PRE>
Bin gerade dabei zu versuchen das irgendwie in Delphi umzusetzen. aber irgendwie wills noch net.. wenn jemand helfen kann wärs net schlecht ;
Comment
Comment