今天看帮助文件看到1:30,没找到检测网络流量的函数
本帖最后由 xwt620 于 2009-11-6 19:55 编辑RT.有没有那位老师知道的能否教教我? 是没有。
一般都是调用网卡信息,循环读取或用三恨放出的那个UDF,不过仅支持WINXP2。。。。 #include <String.au3>
#include <GUIConstantsEx.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 192, 67, 445, 376)
$Label1 = GUICtrlCreateLabel("上传速度:", 24, 8, 55, 17)
$Label2 = GUICtrlCreateLabel("0", 88, 8, 100, 17)
$Label3 = GUICtrlCreateLabel("0", 88, 32, 100, 17)
$Label4 = GUICtrlCreateLabel("下载速度:", 24, 32, 55, 17)
GUISetState(@SW_SHOW)
WinSetOnTop ($Form1,"",1)
$_IfTable=_GetIfTable()
Global $_Down=$_IfTable
Global $_UpDate=$_IfTable
AdlibRegister ("_Strat_Time",1000)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _Strat_Time()
$_IfTable=_GetIfTable()
GUICtrlSetData ($Label2, Round(($_IfTable-$_UpDate)/1024,2)& " Kb")
GUICtrlSetData ($Label3, Round(($_IfTable-$_Down)/1024,2) & " Kb")
Global $_Down=$_IfTable
Global $_UpDate=$_IfTable
EndFunc
Func _GetIfTable()
$_Return=DllCall("Iphlpapi.dll","long","GetIfTable","ptr",0,"ulong*",0,"int",0)
$_aBuffer=DllStructCreate("byte[" & $_Return & "]")
$_Return=DllCall("Iphlpapi.dll","long","GetIfTable","ptr",DllStructGetPtr($_aBuffer),"ulong*",DllStructGetSize($_aBuffer),"int",0)
$_Number=DllStructCreate("dword",DllStructGetPtr($_aBuffer))
$_Number=DllStructGetData($_Number,1)
$_MIB_IFROW="dword" & _StringRepeat(";wchar;dword;byte;dword;byte",$_Number)
$_MIB_IFTABLE=DllStructCreate($_MIB_IFROW,DllStructGetPtr($_aBuffer))
Dim $_Table
For $i=2 To $_Number * 5 Step 5
$_Table+=DllStructGetData($_MIB_IFTABLE,$i+3,4)
$_Table+=DllStructGetData($_MIB_IFTABLE,$i+3,10)
Next
Return $_Table
EndFunc
非常感谢~~~~又学了一招~ 运行时有ERROR: AdlibRegister(): undefined function.
AdlibRegister ("_Strat_Time",1000)提示,如何解啊???? 用AUTOIT_3.3.1.0版本. 顶三楼,找个找了比较长的时间 感觉不准啊~!
页:
[1]