Re 7#:
试下这个,关键是GetIfEntry的ifIndex这个参数要正确,可能每台电脑都会有所不同(?),我这里是2。另外你在7#的代码,最后怎么是/10000呢?速度是以字节为单位的,/10000就可以转成MB了?
如果你不确定网卡的适配器索引,可以看下这个帖子:http://www.autoitx.com/forum.php?mod=viewthread&tid=8533$iSpeed = GetIfEntry(2)
MsgBox(0, @error, $iSpeed & " MB")
Func GetIfEntry($ifIndex)
Local $tagBuffer, $tBuffer, $pBuffer, $iResult, $iSpeed, $sDescr
$tagBuffer = "wchar[256];dword[5];byte[8];dword[16];char[256]"
$tBuffer = DllStructCreate($tagBuffer)
$pBuffer = DllStructGetPtr($tBuffer)
DllStructSetData($tBuffer, 2, $ifIndex, 1)
$iResult = DllCall("iphlpapi.dll","long","GetIfEntry","ptr", $pBuffer)
$iSpeed = DllStructGetData($tBuffer, 2, 4) / 1000 / 1000
$sDescr = DllStructGetData($tBuffer, 5)
$tBuffer = 0
Return SetError($iResult[0], $iSpeed, $iSpeed)
Endfunc ;==>GetIfEntry
|