求助.自动下载安装的AU3程序.
哪位高人会写"自动从远程HTTP下载文件,并且带进度条显示,下载完成后自动运行该文件后退出,的小程序,请帮帮忙,谢了! 可以参考Au3自带的下载更新程序AutoUpdateIt.au3呀。
有进度条,检测版本号等,功能很齐全。
:face (33):
我已经找到了,谢谢!
#include <ButtonConstants.au3>#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
Dim $under, $upon, $per, $res, $filesize, $Inetget, $setup;定义变量
$Form1 = GUICreate("Form1", 200, 8, @DesktopWidth/2-100, 1, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW + $WS_EX_LAYERED) ;创建窗体
GUISetBkColor(0xABCDEF)
_API_SetLayeredWindowAttributes($Form1, 0xABCDEF)
ToolTip("■■■■■软件正在安装中,请稍后■■■■", 400, 200)
$Inetget = "http://192.168.0.244/download/speak/yy.exe";;;
$setup = "d:\yy.exe"
$under = InetGetSize($Inetget) ;获取目标文件大小
InetGet($Inetget, $setup, 1, 1) ;下载目标文件
GUISetState()
While @InetGetActive ;判定循环条件
Sleep(100)
$upon = @InetGetBytesRead ;获取已下载大小
$per = $upon / $under * 100 ;计算比值
$res = StringLeft($per, 3) ;计算百分值
GUICtrlSetData(-1, $res) ;下载进度的值
WEnd
GUISetState (@SW_HIDE,$Form1)
Run($setup)
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
Select
Case @error
Return SetError(@error, 0, 0)
Case $Ret = 0
Return SetError(4, 0, 0)
Case Else
Return 1
EndSelect
EndFunc ;==>_API_SetLayeredWindowAttributes 快一年了...怎没有人顶帖呀. 怎没有人顶帖呀. 帮你顶顶 出错了。运行有好几个错误。 好多错误呀! 太好了,谢谢楼主分享
页:
[1]