;;;;;;;;;;;;;;;检测文件大小呢?
$s = "http://dl_dir.qq.com/qqfile/qq/QQ2010/QQ2010.exe"
$a = InetGetSize($s)
InetGet($s, "QQ2010.exe",0,1)
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("下载文件", 534, 258, -1, -1)
$Progress1 = GUICtrlCreateProgress(56, 56, 425, 25)
$Label1 = GUICtrlCreateLabel("来自:" & StringLeft($s,StringInStr($s, "/", 0, 3)-1), 56, 32, 300, 17)
$Label2 = GUICtrlCreateLabel("估计剩余时间:", 88, 96, 200, 17)
$Label3 = GUICtrlCreateLabel("下载到:QQ2010.exe", 88, 120, 200, 17)
$Label4 = GUICtrlCreateLabel("传输速度:", 88, 144, 200, 17)
$Button1 = GUICtrlCreateButton("打开文件", 72, 200, 113, 33)
$Button2 = GUICtrlCreateButton("打开文件夹", 220, 200, 113, 33)
$Button3 = GUICtrlCreateButton("取消", 365, 199, 113, 33)
GUICtrlSetOnEvent($Button3, "quit")
GUISetOnEvent($GUI_EVENT_CLOSE, "quit")
GUISetState(@SW_SHOW)
$d = 0
While 1
$b = FileGetSize("QQ2010.exe")
$c = $b / $a
$c = $c * 100
GUICtrlSetData($Progress1,$c)
$c = StringLeft($c, 2)
if StringLeft($c, 1) = 0 then $c = "0"
$c = StringReplace($c, ".", "")
WinSetTitle($Form1, "", "下载文件" & $c & "%")
$d = $b - $d
if $d <> 0 then
if $d > 1024 then
$d = $d / 1024 & "KB"
else
$d = $d & "Byte"
endif
ControlSetText($Form1, "", $Label4, "传输速度:" & $d)
endif
$d = FileGetSize("QQ2010.exe")
sleep(500)
WEnd
Func quit()
exit
EndFunc |