请问 inetget怎么计算出下载速度?
请问 inetget怎么计算出下载速度?有例子更好。 Local $Time = TimerInit(), $typeLocal $size = InetGetSize("http://down.360safe.com/setup.exe")
Local $hDownload = InetGet("http://down.360safe.com/setup.exe", @DesktopDir & "\setup.exe", 1, 1)
Do
Sleep(100)
$info = InetGetInfo($hDownload,0)
$s = Int($info/(TimerDiff($Time)/1000)/1024)
TrayTip('下载中'&$type, _
'下载速度:'&$s&'KB'&@CR& _
'下载时间:'&Int($size/1024/$s/60)&'分'&@CR& _
'剩余时间:'&Int(($size-$info)/1024/$s/60)&'分'&@CR& _
'下载大小:'&Int($info/1024)&'KB'&@CR& _
'剩余大小:'&Int(($size-$info)/1024)&'KB'&@CR& _
'下载进度:'&Int($info/$size*100)&'%', 10)
$type &= '.'
If StringLen($type) > 8 Then $type = ''
Until InetGetInfo($hDownload, 2)[ 下载进度=(获取当前下载的字节数/总大小)*100 Local $Time = TimerInit(), $type
Local $size = InetGetSize("http://down.360safe.com/setup.exe")
Local $hDownload = InetGet("http://down.360safe.com/setup.exe", @DesktopDir & "\setup.exe", 1, 1)
Do
Sleep(100)
$info = InetGetInfo($hDownload,0)
$s = Int($info/(TimerDiff($Time)/1000)/1024)
TrayTip('下载中'&$type, _
'下载速度:'&$s&'KB'&@CR& _
'下载时间:'&Int($size/1024/$s/60)&'分'&@CR& _
'剩余时间:'&Int(($size-$info)/1024/$s/60)&'分'&@CR& _
'下载大小:'&Int($info/1024)&'KB'&@CR& _
'剩余大小:'&Int(($size-$info)/1024)&'KB'&@CR& _
'下载进度:'&Int($info/$size*100)&'%', 10)
$type &= '.'
If StringLen($type) > 8 Then $type = ''
Until InetGetInfo($hDownload, 2)
不知道对你有没用~ 感谢分享,收藏哦,{:face (356):}
#include <INet.au3>
Dim $rar, $path,$rul
$url = "http://xiazai.cf84.com/cfxx/cfxx.rar"
$rar = "c:\西西外挂.rar"
$path = "c:\西西外挂\"
$load = InetGet($url, $rar, 1, 1)
ProgressOn("西西外挂", "正在为你下载,请稍后.....")
While 1
If InetGetInfo($load, 2) = True Then ExitLoop
InetGetInfo($load, 1)
$rou = Round(InetGetInfo($load, 0) / InetGetInfo($load, 1), 2) * 100
ProgressSet($rou, "已下载:" & $rou & "%")
Sleep(100)
WEnd
ProgressSet(100, "下载完成")
ProgressOff()
$pid=Run(@ProgramFilesDir & "\winrar\rar.exe x -y c:\西西外挂.rar c:\西西外挂\","",@SW_HIDE)
Do
Sleep(100)
Until ProcessExists($pid) = 0
FileDelete($path & "*.reg")
FileDelete($path & "*.txt")
FileDelete($path & "*.html")
$sousuo=FileFindFirstFile("c:\西西外挂\*.exe")
$file=FileFindNextFile($sousuo)
Run($path & $file)
Exit
这是以前写的外挂自动下载!给你参考一下!虽然很笨,但很容易理解! 回复 3# 破帽遮颜
非常感谢{:face (310):} 谢谢大家{:face (427):}
页:
[1]