#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <iNet.au3>
#include <String.au3>
#Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\administrator\desktop\koda_1.7.2.0\forms\form1.kxf
$Form1_1 = GUICreate("Form1", 587, 603, 201, 169)
$Label = GUICtrlCreateLabel("", 60, 40, 484, 484)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("", 72, 8, 209, 21)
$Label2 = GUICtrlCreateLabel("IP:", 48, 8, 17, 17)
$Testen = GUICtrlCreateButton("Testen", 288, 8, 65, 17, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Testen
$ip = 		ControlGetText("Form1","",$Input1)
;~ TCPStartup()
;~ MsgBox(0,"", _TCPIpToName($ip))
;~ TCPShutdown()
;~ TCPStartup ( )
;~ $name = _TCPIpToName($ip)
;~ GUICtrlSetData($Label,$name)

Run("ping " & $ip & " >c:\ping2.txt")
WinWait("C:\WINDOWS\system32\ping.exe")
;~ ControlSend("C:\WINDOWS\system32\cmd.exe","","ConsoleWindowClass",)
WinMove ( "C:\WINDOWS\system32\ping.exe", "", 2000,2000)



$ping = FileRead("c:\ping2.txt")
GUICtrlSetData($Label,$ping)

;~ $ping2 = _StringBetween($ping,"Antwort von ",": Bytes=32")
;~ StringSplit ($ping, "TTL=64")
;~ If $ping2 = $ip Then
;~ 	GUICtrlSetData($Label,"Online")
;~ 	ElseIf $ping2 <> $ip Then
;~ 		GUICtrlSetData($Label,"Offline")
;~ 	EndIf
;~ 	MsgBox(0,"",$ping & "///" & $ping2)

FileDelete("c:\ping2.txt)
	EndSwitch
WEnd
