#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 303, 167, 328, 249)
$Label1 = GUICtrlCreateLabel("", 24, 64, 244, 17)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
$s1 = 0
$s2 = 0
$strComputer = "."
$wbemServices = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$wbemObjectSet = $wbemServices.ExecQuery("Select * from Win32_PerfRawData_Tcpip_NetworkInterface")
For $wbemObject In $wbemObjectSet
$s1 = $s1 + $wbemObject.BytesReceivedPerSec
Next
Sleep(1000)
$strComputer = "."
$wbemServices = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$wbemObjectSet = $wbemServices.ExecQuery("Select * from Win32_PerfRawData_Tcpip_NetworkInterface")
For $wbemObject In $wbemObjectSet
$s2 = $s2 + $wbemObject.BytesReceivedPerSec
Next
$dd = $s2 - $s1
GUICtrlSetData($Label1, "此刻每秒上传流量是:" & $dd)
WEnd |