Peut etre que ceci peut t'aider:
Code : Tout sélectionner
#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work
Global $hIPAddress,$msg,$texte = ""
_Main()
Func _Main()
Local $hgui
$hgui = GUICreate("IP Ping et Arg", 400, 500)
$hPing = GUICtrlCreateButton("Ping",205,10,40,25)
$hArg = GUICtrlCreateButton("Arg",260,10,40,25)
$hRes = GUICtrlCreateEdit("",10,40,380,450)
GUICtrlSetFont($hRes, 9, 400, 0, "Courier New")
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 45, 10,125,25)
GUISetState(@SW_SHOW)
_GUICtrlIpAddress_Set ($hIPAddress, "1.1.192.168")
; Wait for user to close GUI
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $hPing
$foo=Run(@ComSpec & " /k " & 'ping "'&_GUICtrlIpAddress_Get($hIPAddress)&'"', "", @SW_HIDE,$STDOUT_CHILD)
GUICtrlSetData($hRes,"--------------------------------------"&@CRLF & _
"----------Veuillez Patienter----------"&@CRLF & _
"--------------------------------------"&@CRLF & _
"Ping de l'ip "&_GUICtrlIpAddress_Get($hIPAddress)&" en cours"&@CRLF& _
"--------------------------------------"&@CRLF & _
"----------Veuillez Patienter----------"&@CRLF & _
"--------------------------------------"&@CRLF )
While 1
$line = StdoutRead($foo,false,true)
If @error Then ExitLoop
GUICtrlSetData($hRes,GuictrlRead($hRes)&BinaryToString($line,4))
Sleep(500)
Wend
Case $hArg
$foo = Run("arp -a " & _GUICtrlIpAddress_Get($hIPAddress), @SystemDir, @SW_HIDE, $STDOUT_CHILD)
GUICtrlSetData($hRes,"--------------------------------------"&@CRLF & _
"----------Veuillez Patienter----------"&@CRLF & _
"--------------------------------------"&@CRLF & _
"Arp de l'ip "&_GUICtrlIpAddress_Get($hIPAddress)&" en cours"&@CRLF& _
"--------------------------------------"&@CRLF & _
"----------Veuillez Patienter----------"&@CRLF & _
"--------------------------------------"&@CRLF )
While 1
$line = StdoutRead($foo,false,true)
If @error Then ExitLoop
GUICtrlSetData($hRes,GuictrlRead($hRes)&BinaryToString($line,4))
Sleep(50)
Wend
EndSwitch
Sleep(10)
WEnd
EndFunc ;==>_Main