找回密码
 加入
搜索
查看: 2271|回复: 7

今天看帮助文件看到1:30,没找到检测网络流量的函数

[复制链接]
发表于 2009-11-6 01:39:10 | 显示全部楼层 |阅读模式
本帖最后由 xwt620 于 2009-11-6 19:55 编辑

RT.有没有那位老师知道的能否教教我?
发表于 2009-11-6 02:16:44 | 显示全部楼层
是没有。
一般都是调用网卡信息,循环读取或用三恨放出的那个UDF,不过仅支持WINXP2。。。。
发表于 2009-11-6 09:13:07 | 显示全部楼层
#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[0]
Global $_UpDate=$_IfTable[1]
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[1]-$_UpDate)/1024,2)& " Kb")
        GUICtrlSetData ($Label3, Round(($_IfTable[0]-$_Down)/1024,2) & " Kb")
        Global $_Down=$_IfTable[0]
        Global $_UpDate=$_IfTable[1]
EndFunc

Func _GetIfTable()
        $_Return=DllCall("Iphlpapi.dll","long","GetIfTable","ptr",0,"ulong*",0,"int",0)
        $_aBuffer=DllStructCreate("byte[" & $_Return[2] & "]")
        $_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[256];dword[5];byte[8];dword[16];byte[256]",$_Number)
        $_MIB_IFTABLE=DllStructCreate($_MIB_IFROW,DllStructGetPtr($_aBuffer))
        Dim $_Table[2]
        For $i=2 To $_Number * 5 Step 5                
                $_Table[0]+=DllStructGetData($_MIB_IFTABLE,$i+3,4)
                $_Table[1]+=DllStructGetData($_MIB_IFTABLE,$i+3,10)
        Next        
        Return $_Table
EndFunc

评分

参与人数 5威望 +20 金钱 +235 贡献 +49 收起 理由
remme + 5 我很赞同
kn007 + 20 + 200 + 49 感谢你对论坛的支持,希望以后继续发扬这种 ...
xwt620 + 5 太感谢了
那片叶子 + 10 呀呀呀啊!用上类
kodin + 15 感谢分享。

查看全部评分

 楼主| 发表于 2009-11-6 19:55:48 | 显示全部楼层
非常感谢~~~~又学了一招~
发表于 2009-11-13 08:10:20 | 显示全部楼层
运行时有ERROR: AdlibRegister(): undefined function.
AdlibRegister ("_Strat_Time",1000)提示,如何解啊????

评分

参与人数 1金钱 +1 收起 理由
kn007 + 1 AdlibRegister改为AdlibEnable,请看帮助

查看全部评分

发表于 2009-11-13 08:13:10 | 显示全部楼层
用AUTOIT_3.3.1.0版本.
发表于 2010-6-13 20:55:44 | 显示全部楼层
顶三楼,找个找了比较长的时间
发表于 2013-1-1 12:12:03 | 显示全部楼层
感觉不准啊~!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-29 15:19 , Processed in 0.111997 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表