#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] = 0
Return SetError(4, 0, 0)
Case Else
Return 1
EndSelect
EndFunc ;==>_API_SetLayeredWindowAttributes
|